Comments

Hi there! So I have some questions about comments. Basically here is the situation. I work for a company and was making some components and I was adding minimal sectional comments as little bookmarks like

<!-- change password form -->

to help me navigate my code as I go along and was told to avoid comments like that. The reason was “because it adds bytes”. Seems like even if there are thousands of comments the performance hit will be next to nothing but this is a giant company and they really want to build the best thing they can so I understand to a degree. Anyhow, I asked if I could advocate for a change in that policy which they allowed and it basically boiled down to the comments are fine but they need to be pulled out of the production build. I looked and by default they are not pulled out of the production bundles, but also found that the Vue template renderer removes comments so maybe that somehow doesn’t matter? So basically I am looking for any info that might help me make a better argument for them and/or a simple way to have comments removed from production builds.

because it adds bytes

big oof. :frowning: That might be a losing battle if that’s considered a reasonable argument.

But my first instinct is webpack and uglifyjs. https://stackoverflow.com/questions/35846011/webpack-use-uglifyjsplugin-to-only-remove-comments seems like you can configure it to remove comments when building for prod.