Heroku does not precompile assets when deploying

后端 未结 4 1656
旧巷少年郎
旧巷少年郎 2021-02-03 16:12

It very clearly says in its documentation that it would do this if I don\'t precompile them locally.

And truthfully, I have no interest in precompiling these locally.

相关标签:
4条回答
  • 2021-02-03 16:32

    Some things to check

    1. You're on Cedar, right? Heroku only supports this behavior on Cedar.
    2. You're on Rails 3, right? Heroku doesn't support precompiling assets on Rails 4.
    3. You have asset pipeline turned on, right? in config/application.rb you need the line config.assets.enabled = true
    4. You have to not have a public/assets folder. On deployment Heroku decides whether or not to precompile based on whether this folder is present (even if it's empty).
    5. If the pipeline is on and you don't have an assets folder, then pre-compilation must be failing.
    0 讨论(0)
  • 2021-02-03 16:50

    You might be on the wrong Heroku stack. Make sure you specify stack Cedar when you create apps that use the asset pipeline.

    heroku create -stack cedar

    0 讨论(0)
  • 2021-02-03 16:53

    Try changing to this. I hope this will help you.

    In config/environments/production.rb

    config.assets.compile = true config.assets.digest = true

    0 讨论(0)
  • 2021-02-03 16:55

    The reason it would not deploy was because of Google fonts. Moving the file to your application.css such as :

     *= require_self
     *= require_tree .
     */
    
    
    @import url(http://fonts.googleapis.com/css?family=Special+Elite);
    

    Will allow the app to deploy, and for the fonts to work.

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