Best way to combine and minify JS / CSS on Heroku

后端 未结 8 1284
梦谈多话
梦谈多话 2020-12-24 06:39

First of all, according to this answer, the :cache => true option on stylesheet_link_tag and javascript_include_tag doesn\'t work o

8条回答
  •  执念已碎
    2020-12-24 07:07

    I've found that adding a git pre–commit hook which compiles and packs assets, then adds them to the current commit comes in handy in this case.

    Mine using Jammit looks something like this (in .git/hooks/pre-commit):

    jammit
    rake barista:brew
    git add public/assets/*
    git add public/javascripts/*
    

    Like this all your assets will be packed for you and you don't have to worry anymore about it.

提交回复
热议问题