Grails - Get a graphic resource in CSS

Is there a way to use something like $ {resource (dir: 'images', file: 'myimage.png')} in a CSS file with grails? I can define URLs, usually in CSS, but it is not portable.

+4
source share
2 answers

Try changing the extension of your css file from ".css" to ".css.gsp". You can then use the resource tags inside these files.

0
source

Relative URLs are rewritten by the resource plugin. See this SO question .

If you want to use groovy code and grails plugins inside CSS, you can use the GSP Resource Plugin .

0
source

Source: https://habr.com/ru/post/1494024/


All Articles