css assets not precompiling in production

谁都会走 提交于 2019-12-11 18:34:06

问题


Question, how do you get all .css and .js to be compiled by the asset pipeline?

I tried

config.assets.precompile += %w(*.css, *.js)

and that got all of the .js to precompile. But for some reason the .css file is not compiling.

Suggestions?


回答1:


For anyone trying to do this yourself, the answer had to do with the format of the selectors. precompile take an array of selectors, and the selectors are supposed to be strings, so you could do

config.assets.precompile += ['*.css', '*.js']

to get all css and js files to precompile. You can extend this logic to be more taylored, for example, I was able to group all of the css into 3 manifest files, but still found it more extensible to be able to include any .js, though there were several manifest .js files to make fewer calls on the most popular pages.

config.assets.precompile += ['logged.css','forum.css','editor.css', '*.js']


来源:https://stackoverflow.com/questions/11703127/css-assets-not-precompiling-in-production

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!