node.jsuglifyjs2

How to keep /*! comments with UglifyJS2?


The default behaviour looks for @license or @preserve...

But many plugins and libraries are still using /*! for licensing comment blocks...

How can I use UglifyJS2 to preserve comments starting with /*! ?


Solution

  • See https://github.com/mishoo/UglifyJS2#usage

    Using the --comments argument, you can supply a regular expression.

    uglifyjs jquery.plugin.js --comments '/^\/*!/' -o outfile.js