Confusion about rake assets:clean / cleanup on the asset pipeline in rails

前端 未结 6 1258
忘了有多久
忘了有多久 2020-12-12 20:29

Could somebody explain to me what the command rake assets:clean really does? Unfortunately the Rails Guides dont mention it. There is also the command rak

6条回答
  •  感动是毒
    2020-12-12 20:55

    Note: This answer is rails 3 specific. For rails 4 and later, look at other answers here.

    If you precompile on your local machine, then you can commit these generated assets into the repository and proceed with deployment. No need to compile them on production machine.

    But it introduces a problem: now when you change source files (coffescript / scss), the app won't pick up the changes, because it will serve precompiled files instead. rake assets:clean deletes these precompiled files.

    In my projects assets are precompiled as a part of deployment. Capistrano makes it very easy.

    Also, I never heard of rake assets:cleanup.

提交回复
热议问题