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

Feature remove chunk #596

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from
Open

Feature remove chunk #596

wants to merge 2 commits into from

Conversation

ginnwork
Copy link

@ginnwork ginnwork commented Apr 1, 2016

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>

/_site/
/benchmarks/generated
/node_modules/
/npm-debug.log
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened here? Why are all the lines changed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, didn't mean to commit that. I'm new to the whole pull requests thing so I'm making some mistakes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I'm pretty new to this as well 👻

I am genuinely confused as to why it flags all the lines as changed even though most of them are visually identical.

@alexlamsl
Copy link
Collaborator

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.

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

Successfully merging this pull request may close these issues.

2 participants