blueprint/screen.css isn't precompiled

前端 未结 4 1564
故里飘歌
故里飘歌 2020-12-02 07:56

I\'ve been following along Michael Hartl\'s excellent RoR Tutorial, but I\'m using RoR 3.1. I am a newbie to RoR 3.1 and need help related to assets pipeline. Here is my pro

相关标签:
4条回答
  • 2020-12-02 08:23

    You may want to precompile your assets on production as described above. And if you use capistrano you may do it after code update:

    require 'bundler/capistrano'
    
    after 'deploy:update_code' do  
      run "cd #{release_path}; RAILS_ENV=#{rails_env} bundle exec rake assets:precompile"
    end
    
    0 讨论(0)
  • 2020-12-02 08:37

    I added a reference to the blueprint stylesheets in my application.css file. This way, I do not have to change the layout to modify the stylesheets, I simply need to modify the application.css file, run rake assets:precompile, and restart the webserver (if webrick or similar).

    My application.css currently looks like this:

    /*
     * This is a manifest file that'll automatically include all the stylesheets available in this directory
     * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
     * the top of the compiled file, but it's generally better to create a new file per style scope.
     *= require_self
     *= require_tree ./blueprint
     *= require_tree . 
     */
    
    0 讨论(0)
  • 2020-12-02 08:42

    From http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets

    If you have other manifests or individual stylesheets and JavaScript files to include, you can add them to the precompile array

    This means that in your config/environments/production.rb, you set

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

    or a catchall:

    config.assets.precompile += %w( *.css *.js )
    
    0 讨论(0)
  • 2020-12-02 08:50

    From my own experience with this problem, where I was also going through the excellent RoR tutorial by Michael Hartl, there was one step that I think might be left out at this point...

    bundle exec rake assets:precompile    
    git add public/assets
    git commit -m "vendor compiled assets"
    git push heroku
    

    I found this here.

    0 讨论(0)
提交回复
热议问题