JShrink icon indicating copy to clipboard operation
JShrink copied to clipboard

Documentation: flaggedComments

Open splitbrain opened this issue 2 years ago • 1 comments

It seems the API of this library is quite simple right now (I like it). However there's an option array being passed to the minify method. That options array seems to be undocumented currently. From a quick look at the code, the only option available is flaggedComments which can be true or false. But I am not sure what exactly this option does.

Could you describe what the option does?

splitbrain avatar Mar 11 '23 14:03 splitbrain

Waaaay back in the day the Yahoo UI Compressor added a feature to preserve licenses. Basically if your multiline comment started with /*! instead of just /* then the Yahoo UI Compressor would not strip that comment out. This way libraries that wanted their licenses to be preserved even through minification could do so.

JShrink added that option and made it configurable through the flaggedComments value.

These days javascript compilers will still remove those comments but store them elsewhere. Webpack, for example, rips them out and stores them in a separate "licenses.txt" file. This way they don't violate the whole "attribution" portion of the licenses by stripping them out.

tedivm avatar Mar 11 '23 16:03 tedivm