Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripping comments in production builds #117

Open
chinedufn opened this issue Mar 15, 2018 · 3 comments
Open

Stripping comments in production builds #117

chinedufn opened this issue Mar 15, 2018 · 3 comments

Comments

@chinedufn
Copy link

It looks like we preserve comments when running the browserify transform on the tagged template literals source.

I'd like to remove all comments from production builds in order to:

  1. Not accidentally leak information/context that I did not want to leak in prod.
  2. Reduce build size.

First things that come to mind:

Potential Solution 1

browserify -t [nanohtml --strip-comments ] strips comments


FWIW I wouldn't mind if stripping comments was the default or if nanohtml just always stripped comments since I never use comments in the browser. I only use HTML comments while reading code.

.. But I recognize that other people might want them in by default / that could maybe lead to less confusion maybe.. so whatever works!

@chinedufn
Copy link
Author

Oh and I'm also more than happy to PR this once we know what we want to do!

@goto-bus-stop
Copy link
Member

goto-bus-stop commented Mar 18, 2018

The only reason that the transform has them is because the browser version has them too. We could drop them in both.

@chinedufn
Copy link
Author

Sorry just to clarify - I should PR a removal of the comment handling and we're good to go https://github.com/choojs/nanohtml/blob/master/lib/browserify-transform.js#L112-L114 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants