资产被过滤掉,不会被提供 [英] Asset filtered out and will not be served
问题描述
资产被过滤掉,不会被提供:将 Rails.application.config.assets.precompile += %w( login.js )
添加到 config/initializers/assets.rb
并重新启动您的服务器
Asset filtered out and will not be served: add
Rails.application.config.assets.precompile += %w( login.js )
toconfig/initializers/assets.rb
and restart your server
当我尝试运行我的应用程序时出现上述错误.
I ge the above error when i try to run my application.
<% content_for :javascripts do %>
<%= javascript_include_tag 'login' %>
<% end %>
我已将所有 js 文件放在 assets/javascripts
中,但仍然出现上述错误.
I have placed all my js files in assets/javascripts
, but still i get the above error.
推荐答案
作为替代解决方案,您也可以在 development.rb
上注释掉这一行:
As an alternative solution, you can also comment out this line on development.rb
:
config.assets.raise_runtime_errors
或设置为false
这将禁用开发中的链轮运行时错误(资产被过滤掉并且不会被提供"yada yada 错误).
This will disable sprockets runtime errors (the "Asset filtered out and will not be served" yada yada error) in development.
请记住,通过这样做,您可以掩盖资产的生产错误:例如.一些资产将用于开发,但不会用于生产.(见这个)
Keep in mind that by doing this, you can mask production errors for assets: eg. some assets will be served in development but not in production. (see this)
使用它如果你知道你在做什么:)
Use it if you know what you're doing :)
第
这篇关于资产被过滤掉,不会被提供的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!