You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add configuration option to remove JavaScript inline comments in <script> tags #285
When minifying HTML with minify_js=true, some inline JS comments in <script> are removed but others remain.
The following html tag
<script>
// first comment to be removed
cp('create', id);
// second comment to be removed
cp('render', {
onFullActivation: function () {
console.log(1);
// Last comment to be removed
}
});
</script>
would be minified as:
<script>// second comment to be removed
cp(`create`,id),cp(`render`,{onFullActivation:function(){console.log(1)
// Last comment to be removed
}});</script>
when using minify_js=true.
Setting keep_comments=false only affects HTML comments so it does not help either.
This comes from minify-html/src/minify/js.rs using CommentOptions { annotation: false, ..CommentOptions::default() } and keeping some of the comments.
Could we add a configuration option (e.g. remove_js_comments, with default false to preserve current behavior) that allows us to use CommentOptions::disabled()?
Activity
Add configuration to support use of CommentOptions::disabled() wilson…