Rails 4 asset pipeline doesn't overwrite assets with asset_path references to other assets

前端 未结 2 1838
粉色の甜心
粉色の甜心 2021-01-03 00:52

So we have a small problem with asset pipeline digests in that we have a number of HTML templates as assets (for AngularJS) and we references the paths for these assets in a

相关标签:
2条回答
  • 2021-01-03 01:19

    A solution was suggested here which involves using the depend_on or depend_on_asset directive. In my case adding this to the .js.erb file works:

    //= depend_on_asset views/template.html
    
    url = '<%= asset_path('views/template.html') %>'
    

    This will recompile this file any time there is a change to views/template.html as desired.

    0 讨论(0)
  • 2021-01-03 01:35

    Have you tried running rake assets:clean then rake assets:precompile to recompile?

    UPDATE Not sure if this is the same issue you are facing but it does sound similar. Take a look at this Heroku issue on github.

    If it is the same (or similar), Schneems mentions it takes 3 changes to an asset file for sprockets to clear out the files.

    The recommended steps is to run the following 4 times and compare output:

    echo "body {background-color: red}">> app/assets/stylesheets/application.css
    git add .; git commit -m "assets changed 1"
    git push heroku master
    heroku run ls public/assets | awk /application/
    

    It's probably best you modify the above to suit your situation.

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