html-minifier icon indicating copy to clipboard operation
html-minifier copied to clipboard

Feature remove chunk

Open ginnwork opened this issue 8 years ago • 1 comments

Added the ability to specify chunks of markup to delete. Useful for deleting development only scripts(ex: BrowserSync).

Input:

<p>Stays put</p>
<!-- htmlmin:remove -->
<script id="__bs__">
/* This script tag will be removed entirely */
</script>
<!-- htmlmin:remove-->
<script type="text/javascript" src="app/app.module.js"></script>

Output:

<p>Stays put</p>
<script type="text/javascript" src="app/app.module.js"></script>

ginnwork avatar Apr 01 '16 21:04 ginnwork

Overall I'm not sure whether the feature makes sense to be included in html-minifier. Unlike htmlmin:ignore which is required to workaround sections of the input which would otherwise be invalid HTML, this feature doesn't even relate to HTML at all, and the one-liner can be run before feeding the input into minify() without any loss of functionality.

alexlamsl avatar Apr 03 '16 12:04 alexlamsl