innhyu
innhyu

Reputation: 360

Rails error with asset pipeline "Asset filtered out and will not be served"

I am constantly getting this error

Asset filtered out and will not be served: 'Rails.application.config.assets.precompile..."

and so on for both

<%= stylesheet_link_tag "login" %>
<%= javascript_include_tag "login" %>

I've searched on stackoverflow and read things to find out that I can simply just add the files into the precompiled list as the error says, but I don't know why I have to add this is when I already have the manifest file with

//= require_tree .

I've seen ruby applications where manifest files take care of the job. What's happening?

Upvotes: 0

Views: 119

Answers (2)

Raynor Kuang
Raynor Kuang

Reputation: 489

You're confused about what the manifest does.

//= require_tree . only merges those files into a single large file, whatever file the manifest is in. (Presumably application.js; the whole point being that Sprockets generates a single file that users can cache, instead of needing to load multiple.) It doesn't keep them around as separate files--for that you need to insert them in your assets.rb, as suggested.

Upvotes: 1

nikolayp
nikolayp

Reputation: 17949

add login.css and login.js into your config/initializers/assets.rb

more information is described under Precompiling Assets Guide

Upvotes: 1

Related Questions