-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
Json string is wrapped with backtick #621
Comments
Using backticks (template literals) is the smallest version of the code. The only browser that doesn't support this is IE, but since it is not supported anymore (https://support.microsoft.com/en-us/windows/internet-explorer-help-23360e49-9cd3-4dda-ba52-705336cc0de2) I wasn't planning on supporting it. However, perhaps we could support ECMAVersion < 2015 (template literals were added in 2015) in the JS minifier. |
Implemented, please specify |
@tdewolff m.Add("text/html", &js.Minifier{
Version: 2014,
}) but panic..
how to use JS minifier options? Share my code |
Please see the documentation, you're trying to minify m.AddFuncRegexp(regexp.MustCompile("^(application|text)/(x-)?(java|ecma|j|live)script(1\\.[0-5])?$|^module$"), &js.Minifier{
Version: 2014,
})
// ...
s, err := m.String("text/html", tpl.String()) |
@tdewolff <body>
<div>...</div>
</body>
<script>
var json = {{ . }}
</script> So I minified it to |
No, you minify a file only once. It is initially parsed as HTML, but since HTML can contains XML, JavaScript or CSS, each part is parsed successively by the corresponding minifiers. I've added support for HTML templates in script/style by the way. |
oh! perpect! |
if exist double, single quote in string, string is wrapped with backtick
but backtick is compatible depending on the browser. ( ie browser )
example)
https://play.golang.org/p/I5c1a6yOtjk
Can You Keep value in html/template (tpl.String() ?
The text was updated successfully, but these errors were encountered: