In the nearly here Rails 3.1, the assets pipeline has been improved. Assets files are now stored in their own directories in
app/assets and can be compiled and bundled with sprockets 2. Hence, it's now possible to use sass and CoffeeScript out of the box. You can see DHH's keynote at RailsConf 2011 for more info.
We start a project with Rails 3.1 and we want to share 2 tips about the
require in assets.
Require and sass: if you use the variables or mixins, you should use the
@import of sass instead of
require, each file is compiled separatly and then are bundled together. But if a variable is declared in one file, this declaration will not appear in the compiled CSS and so can't be used in sass files that require this file. But, with
@import, files are regrouped before the compilation and so you'll avoid this problem.
:debug => true on the
<script> tag. For our project, we use this line in our layout file:
I hope you will try the new assets pipeline soon and you will appreciate it!