bertramdev / asset-pipeline

The core implementation of the asset pipeline for the jvm
194 stars 92 forks source link

3.0.6 - js uglification? #232

Closed zyro23 closed 4 years ago

zyro23 commented 5 years ago

seems like 3.0.6 does minify js in terms of whitespace but it does not uglify it.

if i understand it right,

unfortunately, the current evaluation of the closure compiler language modes (in and out) does only allow LanguageMode.ECMASCRIPT_NEXT. if languageIn and languageOut are the same, we get whitespace minification without any variable renaming, it seems.

would be great to have some kind of uglification functionality back. while i think i would prefer babel support for the minify preset, i do not know if that works at all on the jvm without a node environment, and if it does, what the performance looks like.

thank you

aibolit commented 5 years ago

I definitely would like some sort of minification as well. It looks like the there is a babel standalone file located here and invoked the Nashorn engine built into the jvm here.

If a different version of the babel-standalone could be included that supported all of the presets it would just work. The question is where to find this.

davydotcom commented 4 years ago

Restored closures default minify configuration to assume a target and source language on the post processor of ECMASCRIPT 5 since babel transpiles to that anyway. If one wishes to have asset-pipeline use ECMASCRIPT_NEXT it can be set in the minifyOptions in build.gradle Simply set

assets {
  minifyOptions = [languageMode: 'ECMASCRIPT_NEXT']
}
davydotcom commented 4 years ago

This will be resolved in 3.2.3