简体   繁体   English

如何在Rails项目中更改application.css的名称?

[英]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.

相关问题 Rails没有加载application.css - Rails not loading application.css 如何完全删除Rails应用程序中对application.js和application.css的所有引用? - How do I completely remove all references to application.js and application.css in a Rails app? Ruby on Rails-覆盖application.css - Ruby on Rails - Override application.css 在Rails中嵌套布局时,如何防止我的application.css文件包含两次? - When nesting layouts in Rails, how do I prevent my application.css file from getting included twice? 为什么Rails无法在app / assets / stylesheets目录中看到我的application.css文件 - Why can't rails see my application.css file in the app/assets/stylesheets directory Rails 7 sprockets-rails, not regenerating application.css - Rails 7 sprockets-rails, not regenerating application.css 带有通用CSS的Ruby on Rails样式表呈现文件和application.css - Ruby on Rails stylesheet rendering files and application.css with common css rails - 在生产模式下找不到application.css资产 - rails - application.css asset not found in production mode Rails应用程序未在application.css中选择样式 - Rails app not picking up styles in application.css 从Windows更改为Ubuntu时,Rails Application.css为空 - Rails Application.css empty when changing from Windows to Ubuntu
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM