-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
separate keep_classnames
& keep_fnames
#2418
Comments
Your summary is good. I'd just add the ability to specify specific names via either RegExp/array for each mangle/compress |
The |
I could write it, but your version would be half the number of lines. Also there would be some interaction and/or conflict with |
Slightly OT: do you remember which issues call for |
I propose grandfathered option behavior for harmony: when compress/mangle |
OTOH, Keeping them separate without any inter-dependency logic makes for cleaner code - yes it would change the current behaviour on |
It would amount to just one extra --- a/lib/minify.js
+++ b/lib/minify.js
@@ -51,6 +51,7 @@ function minify(files, options) {
compress: {},
ecma: undefined,
ie8: false,
+ keep_classnames: false,
keep_fnames: false,
mangle: {},
nameCache: null,
@@ -62,12 +63,16 @@ function minify(files, options) {
warnings: false,
wrap: false,
}, true);
+ if (!options.keep_classnames && options.keep_fnames) {
+ options.keep_classnames = options.keep_fnames;
+ }
var timings = options.timings && {
start: Date.now()
};
set_shorthand("ecma", options, [ "parse", "compress", "output" ]);
set_shorthand("ie8", options, [ "compress", "mangle", "output" ]);
set_shorthand("keep_fnames", options, [ "compress", "mangle" ]);
+ set_shorthand("keep_classnames", options, [ "compress", "mangle" ]);
set_shorthand("toplevel", options, [ "compress", "mangle" ]);
set_shorthand("warnings", options, [ "compress" ]);
var quoted_props; Even ignoring |
Ah I see that you are confining that magic in top-level options, i.e. |
Correct. |
OT - Angular 5 transpiles down to ES5 so it would not exercise ES6 minification, however probably half of
|
|
Bug report or feature request?
Feature
ES5 or ES6+ input?
ES6
Uglify version (
uglifyjs -V
)uglify-es 3.1.6
This continues from #2416 (comment)
Basically, the proposal is to separate
class
-related functionalities fromcompress.keep_fnames
into a newkeep_classnames
, then combine with that ofmangle.keep_classnames
to have a top-level--keep-classnames
flag./cc @kzc
The text was updated successfully, but these errors were encountered: