Minification with Both Uglifier and esbuild

Curated ago by @jeremysmithco


If you are working on legacy Rails projects with old ES5 code, but have also switched to jsbundling-rails, esbuild for new ES6 code, you may have struggled to find a good approach to minifying all your assets. Uglifier only works with ES5 and may cause issues in Harmony mode.

Inspiration for this approach came from Optionally skip compression for specific files and Custom sprockets compressor as proxy skips minified assets.

//= link_tree ../builds
//= link_tree ../images
//= link legacy.js