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

Allow some comments #51

Open
adam-lynch opened this issue Jun 17, 2015 · 8 comments
Open

Allow some comments #51

adam-lynch opened this issue Jun 17, 2015 · 8 comments

Comments

@adam-lynch
Copy link

See https://github.com/murphydanger/gulp-minify-html/issues/27

@adam-lynch
Copy link
Author

Nevermind, going with gulp-htmlclean (it accepts regular expressions).

@Swaagie
Copy link
Owner

Swaagie commented Jun 18, 2015

Sure feel free to use what you want :) thats why OS is awesome. Re-opening this though as I can easily add this functionality.

@Swaagie Swaagie reopened this Jun 18, 2015
@adam-lynch
Copy link
Author

👍

What would the API look like?

@Swaagie
Copy link
Owner

Swaagie commented Jun 18, 2015

I was thinking about a plugin that would allow the comments, have to give it some thought though, don't want to just make it a configurable option, as it is highly opinionated towards Knockout (which is fine, but not for a general HTML minifier ;))

@dtipson
Copy link

dtipson commented Jun 18, 2015

Have this need as well: would it make sense to allow the ssi option to accept a regex in addition to a boolean that would then protect anything that matches? I'm using this in conjunction with underscore/lodash templates, and if I try to use the spare:true option, then something like <% if (data){ print="foo"; } %> becomes something like <% if="" (data)="" {="" print="foo";="" }="" %>

@Swaagie
Copy link
Owner

Swaagie commented Jun 18, 2015

Minimize really shouldn't be used on templates though, only the rendered output of the template should be ran through minimize. In your defence, do you render the template client side/browser as I can see a use case for that? In your example spare won't help as it only works for element attributes not variable assignments

@dtipson
Copy link

dtipson commented Jul 8, 2015

Yep, in my case of templates, there is no final rendered output: the html templates (plus language specific control code) is intended to be minified (currently using minimize via a gulp task) before being run through a template compiler. Javascript code like value == 5 gets turned into value "==" 5. Would definitely be nice to specify custom ignore delimiters, but I understand if you think that's out of scope of something intended to deal just with compliant html.

@Swaagie
Copy link
Owner

Swaagie commented Jul 9, 2015

I dont see why template code needs to be minified before parsing it though? Its just an order of task executions. Compile first, minimize after and you should be fine. The reason the JS code (in case of ejs) is mistakingly minified is because the checks look like HTML attribute assignments. Could you give an example of why the order of execution has to be minimize and then compile?

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

3 participants