到目前为止,我的所有应用程序的CSS都通过application.css.scss ,如下所示:
/* ... *= require jquery-ui *= require_self *= require_tree . */ @import "bootstrap";在调试时,我发现清单HAS被称为application.css
我错过了一些很好的机会。 但是,如果将问题解决回原来的问题,我只关注应用程序的样式表本身。
我发现当它被称为application.css.scss ,它被编译得很好但是当名称被更改时它没有得到处理:
这样可行:
application.html.haml
... = stylesheet_link_tag "application" ...是什么让“application.css.scss”变得特别?
为什么会这样? 为什么我不能只使用任何旧名称的清单文件?
(如果它完全相关我正在部署到Heroku)
Up until now all of my application's CSS has been served through application.css.scss which looks like this:
/* ... *= require jquery-ui *= require_self *= require_tree . */ @import "bootstrap";On debugging I discovered that the manifest HAS to be called application.css
There's a good chance I'm missing something. BUT on stripping the problem back to its bare essentials I looked just at the application's stylesheet itself.
What I found was that when it was called application.css.scss, it was compiled just fine but when the name was changed it didn't get processed:
So this works:
application.html.haml
... = stylesheet_link_tag "application" ...What makes "application.css.scss" special?
Why is this going on? Why can't I just use a manifest file that has any old name?
(if it's at all relevant I'm deploying to Heroku)
最满意答案
如果要将样式表用作独立文件,则必须将样式表添加到预编译中。
# config/environments/production.rb # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. config.assets.precompile += %w(testing.css)You have to add stylesheets to the precompilation if you want to use them as a standalone file.
# config/environments/production.rb # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. config.assets.precompile += %w(testing.css)更多推荐
发布评论