Closed adamjimenez closed 13 years ago
Please file an issue against Douglas Crockford's canonical JSMin repository here: https://github.com/douglascrockford/JSMin
jsmin.php is meant to be a faithful port of jsmin.c, not a fork with new functionality.
JSMin gives a command line option to include comments.
e.g.
jsmin
Can this be included?
jsmin.php itself is a library, not a command line tool, but you could certainly write a command line tool that wraps it and does this. It would just need to prepend any desired comments to the output of JSMin::minify
.
Alternatively, you can do this in your scripts:
$js = '/* My awesome comment */' . JSMin::minify($js);
JSMin should preserve important comments e.g. copyright or license info. Otherwise webmasters could unknowingly be infringing on copyright when including 3rd party code.
YUI compressor gets around this by checking for important comments e.g: /! Somthing very important /
See more about this issue: http://zoompf.com/blog/2009/11/jsmin-important-comments-and-copyright-violations
And a fork of JSmin that has solved this problem: http://fmarcia.info/jsmin/test.html