matthiasmullie / minify

CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.
https://matthiasmullie.github.io/minify/
MIT License
1.97k stars 309 forks source link

Minifying Multiple CSS/JS Files & Creating a Single, Minified File Without Repeated Standard Header Comments #421

Open broberts-dev opened 7 months ago

broberts-dev commented 7 months ago

I have a use case in which I'm minifying multiple CSS/JS files (i.e. a call to Minify::add() or Minify::addFile() for each file followed by a call to Minify::minify()), but the minified output contains the repeated standard header comments, including those containing @license. For what it's worth, this is all our code, so it's our license.

As I've looked through the documentation and source, I haven't determined a way of removing the standard header comments (with @license) or removing them AND then adding back one standard header comment (with @license) at the top of the final minified output/file.

If this is possible and I'm simply overlooking it, any direction or tips would be appreciated. It seems it would be possible if the comment removal behavior was configurable to some extent (e.g. allowing all comments to be removed regardless of @license).