Rails 3.1 Assets - Strange Serving in Development

后端 未结 5 1605
离开以前
离开以前 2020-12-02 09:04

I\'ve got a problem with Rails 3.1 assets pipeline. Assets are included twice in development:



        
5条回答
  •  粉色の甜心
    2020-12-02 09:46

    This just caused me a problem. Setting the following makes the app work but includes the single application.js file - which I don't want in development:

    config.serve_static_assets = false
    

    I had pre-compiled my assets previously (seems to be the cause).

    To fix it I did the following:

    • Remove the public/assets dir that the earlier precompilation had added.
    • Run RAILS_ENV=development rake assets:clean to clear out tmp/assets
    • Edited app/assets/application.js

    It was only after I edited application.js so it errored and then corrected it that the applciation.js included in the pages was not the full, precompiled application.js.

    I'm not sure if all of those need to be done. I was also re-starting my server along the way.

提交回复
热议问题