Open peixotorms opened 5 years ago
With someting like that?
/**
* Strip comments from source code.
*/
protected function stripComments()
{
// PHP only supports $this inside anonymous functions since 5.4
$minifier = $this;
$callback = function ($match) use ($minifier) {
$count = count($minifier->extracted);
$placeholder = '/*'.$count.'*/';
$minifier->extracted[$placeholder] = $match[0];
return $placeholder;
};
- $this->registerPattern('/\n?\/\*(!|.*?@license|.*?@preserve).*?\*\/\n?/s', $callback);
+ $this->registerPattern('/\n?\/\*(!|.*?@license|.*?@preserve|# sourceMappingURL).*?\*\/\n?/s', $callback);
$this->registerPattern('/\/\*.*?\*\//s', '');
}
https://github.com/matthiasmullie/minify/blob/master/src/CSS.php#L640
Hi there,
Some developers add source maps to JavaScript files. This allows you to debug with readable code in your browser's developer tools when working with minified JS files. > https://www.html5rocks.com/en/tutorials/developertools/sourcemaps/
For example, the minified version of Underscore has this line at the end of the file:
//# sourceMappingURL=jquery.rateit.min.js.map
The browser developers tools will try to download underscore-min.map when encountering this line, however for the sake of minification, there should be a way to remove this lines automatically, or with an option.
Is it possible on PHP Minify, or can you make it a feature request? Thanks