Add this line to your application's Gemfile:
gem 'assets-minify-rails'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install asset-minify-rails
When you do asset:precompile, minify runs automatically. Note that this will overwrite the existing path. The following tasks can also be done independently.
$ rails assets_minify:compress
This gem minifies js, css files under Rails.application.config.output_path.
engine | extension | Rails::Application.config.js_compressor | Rails::Application.config.css_compressor |
---|---|---|---|
terser | .js | terser | - |
yui | .css, .js | yui, yui_compressor | yui, yui_compressor |
postcss | .css | - | postcss |
Bug reports and pull requests are welcome on GitHub at https://github.com/newsdict/assets-minify-rails.
The gem is available as open source under the terms of the MIT License.