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

Mishandling Underscore/LoDash Template Strings #57

Closed
willpracht opened this issue Sep 2, 2015 · 3 comments
Closed

Mishandling Underscore/LoDash Template Strings #57

willpracht opened this issue Sep 2, 2015 · 3 comments

Comments

@willpracht
Copy link

Looks like minimize is interpreting Underscore template strings as HTML elements.

Example:

Original

<h1>
  <%= myTitle %>
</h1>

Minified

<h1><%= mytitle %></%=></h1>

It would be nice if it recognized these template strings and didn't attempt to either close the tag or transform the placeholder to lowercase.

@Swaagie
Copy link
Owner

Swaagie commented Sep 10, 2015

Sorry for the late response, was on holiday the last week. It would be nice, but this cannot be done by minimize. This requires a custom domparser for htmlparser2 that understands the fact template strings are included in the HTML. I won't add support for this directly in the module, rather i'd make sure minification happens until after the template is parsed

@willpracht
Copy link
Author

Hey, not a problem. I know we've all got lives outside of work (hopefully).

I ended up having to switch over to html-minifier via gulp-htmlmin (instead of gulp-minify-html) which uses minimize.

Unfortunately I have to do my minification before parsing the template. We're generating our $templateCache (Angular) from our templates, then parsing said templates full of LoDash template strings later on when the app is served. Not really the most ideal situation, admittedly. And maybe that's our real solution, to strip these template strings altogether and utilize the power of Angular expressions in all instances instead of most.

@willpracht
Copy link
Author

Thanks for the reply, man. Appreciate your time :).

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