0

I have an some HTML like this:

<div>
  <!-- CUSTOM REMOVE HTML -->
     <button>Only seen in unminified version</button>
  <!-- END OF CUSTOM REMOVE HTML  -->
</div>
<script>
  function commonLogic(){....}
  // CUSTOM REMOVE JS
  console.log(document.getElementById('btn'))
  // END OF CUSTOM REMOVE JS
  function moreCommonLogic(){....}
</script>

Is it possible to add options to the html-minifier-terser to remove lines between those special comments, like this?

.minify({
   ... // other options
   "html_customized_removal_prefix":"<!-- CUSTOM REMOVE HTML -->",
   "html_customized_removal_suffix":"<!-- END OF CUSTOM REMOVE HTML -->",
   "js_customized_removal_prefix":"<!-- CUSTOM REMOVE JS -->",
   "js_customized_removal_suffix":"<!-- END OF CUSTOM REMOVE JS -->"

})

This is because sometimes I need some buttons to appear in the dev mode while not appearing in the live mode.

AGamePlayer
  • 7,404
  • 19
  • 62
  • 119

0 Answers0