html-minifier
html-minifier copied to clipboard
Feature remove chunk
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>
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.