Assets are filtered and will not be serviced

The object is filtered and will not be serviced: add Rails.application.config.assets.precompile += %w( login.js )to config/initializers/assets.rband restart the server

I am trying to run the application described above.

<% content_for :javascripts do %>
    <%= javascript_include_tag 'login' %>
<% end %>

I put all my js files in assets/javascripts, but still I got the above error.

+2
source share
3 answers

You must include all the js / css files that you add to the methods #javascript_include_tagand #stylesheet_link_tagto the array Rails.application.config.assets.precompile. Check config/initializers/assets.rb(create if it does not exist). Here's how it should look:

Rails.application.config.assets.precompile += %w( login.js )

Restart the Rails server after editing.

By the way, this is self-evident from the error text.

Rails Assets Pipeline: http://guides.rubyonrails.org/asset_pipeline.html.

+8

development.rb:

config.assets.raise_runtime_errors

false

( " Asset " yada yada) .

, : . , . (. this)

, , :)

HTH

+8

I am doing something similar, but have added additional resources to Production.rb

config.assets.precompile += ['landing.css', 'landing.js']
+2
source

Source: https://habr.com/ru/post/1613951/


All Articles