Rails assets - keep license comments

2020-08-22 03:19发布

问题:

How can I prevent Uglifier from removing some comments from some files? I want to have code minified and compressed but also I want the licensing comments to remain intact.

回答1:

From the documentation of uglifyJS.

-nc or --no-copyright — by default, uglifyjs will keep the initial comment tokens in the generated code (assumed to be copyright information etc.). If you pass this it will discard it.

which is also an option of uglifier.