Grails won't load changes done in static resources (except when restarting)

前端 未结 2 2009
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-20 18:25

I have an annoying problem with my new grails app. I\'m trying to mock up a design for a site that I will be making but whenever I do changes in my css it won\'t affect the runn

相关标签:
2条回答
  • 2021-02-20 18:52

    Add this to your Config.groovy (probably just for development)

    grails.resources.debug = true
    

    Read the docs for more info.

    0 讨论(0)
  • 2021-02-20 19:06

    It looks like Gregg's answer doesn't work for 1.3.7 (maybe that is something added in 2.x?). A method I found that makes quick CSS updates possible is to include a separate GSP as a template in the page header.

    That is, create a file called "_css.gsp" (underscore prefix is required) in the same directory as your view files, fill it with standard css surrounded by html style tags, and then include the following in your layout header or page:

    <g:render template="css" />
    

    With that in place, the content of _css.gsp is injected into the page. And I can make changes to _css.gsp and they are immediately reflected after page refresh without having to restart Grails. Hope this helps someone in Grails pre-2.x!

    0 讨论(0)
提交回复
热议问题