Rails won't load asset pipeline

前端 未结 6 1842
时光说笑
时光说笑 2021-01-18 05:21

I ran rake assets:precompile by mistake on development, and Rails stopped loading the assets on development. I only get application.js and ap

6条回答
  •  暖寄归人
    2021-01-18 05:44

    tl;dr

    1. $ rake assets:clean
    2. restart rails server $ rails server -e development
    3. clear browser cache, or do a ctrl+shift+r on the app page

    Now everything should be as it was before you ran rake assets:precompile

    -- end tl;dr --

    If the above doesn't work, then a detailed list of steps:

    1. Do $ rake assets:clean or $ rm -rf public/assets to remove the generated assets.
    2. In application.rb, ensure:
      • config.assets.enabled = true (to enable rails' asset pipleline)
    3. In development.rb, ensure:
      • config.assets.compress = false (so as to not gzip the assets)
      • config.assets.debug = true (so as to not merge all css and js files into application.[cs|js])
      • config.assets.compile = true (or not set - to enable runtime compilation of assets)
      • config.serve_static_assets = false (or not set)
    4. Finally, restart your rails server $ rails server -e development

    This should fix it.

提交回复
热议问题