As a best practice, when you enhance your Rails app’s assets:precompile
task to build static assets that can be served faster than if they needed to be compiled at runtime, you should also enhance assets:clobber
to remove the artifacts you create.
Rails built in precompile task will build assets by running CSS and JavaScript through preprocessors, combine them into a single file (or more, depending on setup), and give them file names with SHA sums.
The assets:clobber
Rake task is the less well-known sibling of assets:precompile
. It’s really useful when you want to be able to verify that your build process works correctly that you can also tear it down completely. This avoids running with precompiled assets in your development environment, for example. In the default case it deletes the files generated by assets:precompile
.
Both of these tasks (and indeed any other Rake task) have additional tasks run either before or after their current behavior. To run before, you’d add
Read More