[英]How can I change the name of application.css in a rails project?
I'd like to change the name of the file of application.css but this yields the following error: 我想更改application.css文件的名称,但这会产生以下错误:
Asset filtered out and will not be served
I'm assuming this is because somewhere in the config files, rails is told to precompile application.css
, and when I change its name, the config file still looks for application.css
. 我假设这是因为在配置文件中的某处,rails被告知要预编译application.css
,并且当我更改其名称时,配置文件仍会寻找application.css
。 can someone explain to me how I would go about doing this? 有人可以向我解释我将如何去做吗?
I ask because I would like to learn how to create my own manifest files for different controllers. 我问是因为我想学习如何为不同的控制器创建自己的清单文件。
Have you tried include your new .css file to the list: config.assets.precompile += %w( newname.css ) in 'config/environtment/production.rb'? 您是否尝试过将新的.css文件包括在列表中:config / environtment / production.rb中的config.assets.precompile + =%w(newname.css)?
The joke is in that you probably on the last rails 4 version. 开个玩笑是因为您可能在最后一个rails 4版本上。 The rails team included sprockets_better_errors gem into out of the box functionality, so it checks 'precompilability' of assets even in development mode. Rails团队将sprockets_better_errors gem包含在开箱即用的功能中,因此即使在开发模式下,它也可以检查资产的“可预编译性”。 Prior to that, you would not see any error, until deployment to the production 在此之前,除非部署到生产环境,否则您不会看到任何错误。
Hope it helps 希望能帮助到你
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.