Tags for minified output comments

Nov 16, 2010 at 8:05 PM

I might just not be able to find it.  But it would be nice to have output tags to place copyright headers, etc. 

Also support for a "leave alone" block to selectively disable compression.  This would be handy when new introduced syntax gets ahead of the minification tool, or to overcome a bug in the tool.

Coordinator
Nov 16, 2010 at 8:18 PM

You can keep copyright notices and other important comments in your output using the "important comment" syntax. So for instance, if my source has this comment in it:

/*! Copyright 2010 by Contoso Corp. All rights reserved */

[note the placement of the exclamation point immediately following the "/*" sequence] the output will be:

/* Copyright 2010 by Contoso Corp. All rights reserved */

(Keeps the comment, but removes the exclamation point). This will work for both the JS and the CSS syntax.

A "leave alone" block could be a good idea. I'll have to think about how it would be implemented and what ramification it would entail. Might just treat it the same way as an eval statement.  

Thanks! -r

Coordinator
Nov 16, 2010 at 9:35 PM

Thanks to your post I noticed (and fixed) two bugs around important-comments:

  1. multiple adjacent important comments were only retaining the last one, and
  2. a file that ends in an important comment was losing the important comment.

These are both fixed with changeset #63797 (version 4.8).

Thanks!