Retain JS comments that're flagged for it#14
Retain JS comments that're flagged for it#14kemayo wants to merge 1 commit intoPeterDaveHello:masterfrom
Conversation
Comment blocks that start with `/*!` are trying to flag themselves as licenses, and should be left in minified source for copyright purposes.
|
Thanks @kemayo! Since the src is still there, I wonder if this is necessary? Maybe the users can just fetch the src for license info? I'm also concern about if that still always for license info, maybe not, right? Preserving some comment block for small files may also cause the issue about "minify or not", since the minified file + map file may be even greater than the origin one. What do you think? |
|
There's two arguments here, intention-based and legal. Intention-based is simpler: we're leaving in comment blocks that the library author has explicitly tagged as "I want this preserved even through minification", so we should probably respect that. Legal requirements are more fiddly, and I acknowledge that most people will wind up saying "eh, it's a minified version, that's okay". Most open source licenses say that you have to include it with any source distribution, and the minified version is still source. So if you strip it, you're (technically) breaking the license agreement and thus aren't allowed to distribute it at all. e.g. the MIT says "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software." GPL and BSD contain similar provisions. |
|
Oh, the size concern, sorry. Minified-with-license + map might, in edge cases, be bigger than the original. However, source maps are only downloaded if the dev tools are open, so the end-user should always be getting a smaller download. (The added content from source maps before you open the dev tools is one comment, which is about 30 characters long, so...) |
Comment blocks that start with
/*!are trying to flag themselves as licenses, and should be left in minified source for copyright purposes.