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

Option to process template #175

Open
dev-bjoern opened this issue Dec 30, 2018 · 2 comments
Open

Option to process template #175

dev-bjoern opened this issue Dec 30, 2018 · 2 comments

Comments

@dev-bjoern
Copy link

dev-bjoern commented Dec 30, 2018

I would like to propose an option/feature allowing to process the returned template(string).
I need it to remove white space, empty lines and tabs from the compiled template.
A similar option is already present in the grunt plugin via "processContent".

I would use it e.g. like so:

  processContent: function(content) {
    return content.replace(/\n/g, '');
  }

Anything like this possible?

@pizatski
Copy link

pizatski commented Jan 8, 2019

I've been noodling with something like this in a local fork and would be happy to take it on.

The savings are not astronomical - especially considering how good gzip is at removing empty strings, but there are savings when loading the files for SSR and some of the boilerplate in the compiled templates is reduced.

pizatski added a commit to pizatski/handlebars-loader that referenced this issue Jan 9, 2019
… run handlebars template through html minifier
pizatski added a commit to pizatski/handlebars-loader that referenced this issue Jan 9, 2019
… run handlebars template through html minifier
pizatski added a commit to pizatski/handlebars-loader that referenced this issue Jan 9, 2019
@pizatski
Copy link

@chickenwing I have a PR here against the handlebars-loader:
#177

I think I may change it so that you can pass the options for html-minifier where handlebars-loader is configured in the implementor's webpack configuration so that the loader isn't dictating the kind of compression settings the project may be looking for.

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