blueprint css rails 3.1 help

后端 未结 4 1439
心在旅途
心在旅途 2020-12-14 08:06

My blueprint css works on my local machine, but when I push to heroku I get an error.

I have blueprint stored in my app/assets/stylesheets folder and he

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

    Try setting your:

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

    in config/environments/production.rb

    I'm sure someone with more experience than me can tell us why all css files aren't pre-compiled as standard. I'm only just starting out too!

    Here's at least one discussion: Rails 3.1 asset pipeline - missing files from public/assets - why isn't this the default?

    0 讨论(0)
  • 2020-12-14 08:29

    One way to fix this is to precompile the assets by running rake assets:precompile. You have to include a javascript runtime for this by adding

    # Gems used only for assets and not required
    # in production environments by default.
    group :assets do
      gem 'therubyracer'
      gem 'sass-rails', "  ~> 3.1.0"
      gem 'coffee-rails', "~> 3.1.0"a
      gem 'uglifier'
    end
    

    to the Gemfile and run bundle install.

    0 讨论(0)
  • 2020-12-14 08:33

    I just had the same problem. I solved it by setting config.assets.compile = true in config/environments/production.rb

    EDIT: This works fine while developing, but has a performance penalty as compilation is performed in run-time. See the answer below for a better solution

    0 讨论(0)
  • 2020-12-14 08:33

    I tried to run rake assets:precompile and couldn't get it to work. I have the assets group in my Gemfile. I read somewhere that I should make sure to precompile the production env:

    RAILS_ENV=production bundle exec rake assets:precompile

    That didn't help either. I ended up doing the config.assets.compile = true, which worked fine, but I would love to get the real solution to work.

    I never get the -----> Preparing Rails asset pipeline when pushing to heroku that they say one should get.

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