Reputation: 250
I'm using rails 5.2.0 and I got this error: Sprockets::Rails::Helper::AssetNotPrecompiled - Asset was not declared to be precompiled in production
when I open my page home.
I have already set Rails.application.config.assets.precompile += %w( home.css, home.coffe )
but this error still comes.
Here is my application.html.rb
<%= stylesheet_link_tag 'application'%>
<%= stylesheet_link_tag params[:controller] %>
<%= javascript_include_tag 'application'%>
<%= javascript_include_tag params[:controller]%>
My intentions are to load only the scss and js specific of each controller.
Upvotes: 2
Views: 2407
Reputation: 1230
%w
creates an array of words using whitespace to separate each value
%w( home.css, home.coffe )
returns
["home.css,", "home.coffe"]
change code to
Rails.application.config.assets.precompile += %w( home.css home.coffe )
Upvotes: 1