Rails 3.2.1 asset pipeline not handled / sellers / assets / style sheets?

I read "Rails Tutorial: Learn Rails 3.2 by Example" , but I have a little problem at the end of chapter 4.

In the book, you download the Blueprint css framework, add it to / vendor / assets / stylesheets, and then reference it in layouts / application.html.erb using:

<%= stylesheet_link_tag 'blueprint/screen', :media => 'screen' %> <%= stylesheet_link_tag 'blueprint/print', :media => 'print' %> <!--[if lt IE 8]><%= stylesheet_link_tag 'blueprint/ie' %><![endif]--> 

This works fine on my local machine, but when I use it for a hero (cedar) using

 $ bundle exec rake assets:precompile $ git push heroku 

It gives an error while viewing the site:

 app[web.1]: Completed 500 Internal Server Error in 71ms app[web.1]: ActionView::Template::Error (blueprint/screen.css isn't precompiled): app[web.1]: 4: <%= stylesheet_link_tag 'blueprint/screen', media: 'screen' %> app[web.1]: 5: <%= stylesheet_link_tag 'blueprint/print', media: 'print' %> 

Currently, the only way I could get it to work is to manually tell the rails about the drawing style sheets by putting them in production.rb

 config.assets.precompile += %w( blueprint/screen.css blueprint/print.css blueprint/ie.css ) 

Am I doing something wrong? Is there a way to get rake assets:precompile to automatically minimize / compress all files in / vendor / assets / (if so, are there any flaws for this)?

Thanks in advance for any advice.

+6
source share
3 answers

If you want to directly link to files in the pipeline, as you are here, it is expected that you add these files to the precompilation array so that they can work during production.

There is nothing wrong with that.

You can add a catch-all rule for pre-compilation for the provider / assets, but I personally think that it is better to add everything you need so that you know what is happening in your application.

+1
source

The approach described in fooobar.com/questions/142757 / ... helped me solve this.

+1
source

I have the same problem. However, after I changed the line code in config / environment / production.rb

OLD: config.assets.compile = false for NEW: config.assets.compile = true

commit -am "......" git push git push heroku

Finally it works

-3
source

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


All Articles