Rails using cached application.css despite changes

后端 未结 9 613
萌比男神i
萌比男神i 2020-12-30 00:53

I have a Rails 3.1 application that uses SASS. The application.css.scss file looks like:

@import \'reset.css\';
@import \'960.css\';
@import \'p         


        
9条回答
  •  清歌不尽
    2020-12-30 01:32

    You can invoke Rails automagic cache busting by doing the following:

    1. Rename the SASS file as a partial, i.e. with an underscore prefix. E.g. _master.css.scss
    2. Remove the extension from the import. You can keep the paths, but exclude the underscore. E.g. @import 'pages/master';

    Now you can make changes in master and have them reflected without messing with the cache manually.

    (Note: I'm on Rails 4.2)

提交回复
热议问题