开发者

rails 3 sass compiling

Hello I have one question I have my file main.scss which is in public/stylesheets/scss. In documentation is written:

By default, .sass and .scss files are placed in public/stylesheets/sass (this can be customized with the :template_location option). Then, whenever necessary,开发者_JAVA百科 they’re compiled into corresponding CSS files in public/stylesheets. For instance, public/stylesheets/sass/main.scss would be compiled to public/stylesheets/main.css.

I have in my gemfile gem 'haml' And from my view I do sth like this

= stylesheet_link_tag 'main'

And the file is not found when I check the source(there is a file with with information about routing error). I guess that compiling it by hand it is not way to go so how I can make compile scss file to public/stylesheets automatic? What mean in documentation that they are compiled when necessary? Thanks in advance


Put your .sass or .scss files in public/stylesheets/sass, not public/stylesheets/scss. Then the stylesheets should automatically generate whenever you change the corresponding sass/scss file. The generated stylesheets end up in public/stylesheets/.

Renaming the folder should make it all work.

EDIT: it looks like Rails 3.1 is going to be not only including SASS by default, but it will also be moving most of the stuff found in the public folder to the app folder... so this answer will only apply to versions of rails before 3.1.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜