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

Minify script templates #11

Open
maltsev opened this issue Feb 1, 2016 · 3 comments
Open

Minify script templates #11

maltsev opened this issue Feb 1, 2016 · 3 comments

Comments

@maltsev
Copy link
Member

maltsev commented Feb 1, 2016

Source:

<script type="text/x-handlebars-template">
    <div class="entry">
        <h1>{{title}}</h1>
    </div>
</script>

Minified:

<script type="text/x-handlebars-template"><div class="entry"><h1>{{title}}</h1></div></script>
@icai
Copy link

icai commented Jan 12, 2018

+1

@SukkaW
Copy link
Contributor

SukkaW commented Oct 10, 2020

Instead of having a built-in template list, what about implementing the feature like this:

{
  minifyHtmlTemplate: [
    // [Tag Name, Attribute Name (Optional), Attribute Value (Optional)]
    ['script', 'type', 'text/x-handlebars-template'], // Matches script[type='text/x-handlebars-template']
    ['template', id, 'my-template'] // Matches template[id='my-template']
  ]
}

or this:

{
  minifyHtmlTemplate: [
    { tag: 'script', attrs: { type: 'text/x-handlebars-template' } }, // Matches script[type='text/x-handlebars-template']
    { tag: 'script', attrs: { id: 'my-template' } }, // Matches template#my-template
}

@maltsev
Copy link
Member Author

maltsev commented Oct 11, 2020

Looks good to me!

Instead of having a built-in template list

I think it's still good if we provide some built-in template list with an option to replace it or provide additional rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants