ember-hbs-minifier
Stripping whitespace out of your Handlebars templates
Disclaimer: This is an experiment and might change in the future. Do not
use this for production yet unless you understand the consequences!
Compatibility
- Ember.js v3.20 or above
- Ember CLI v3.20 or above
- Node.js 12 or above
Installation
ember install ember-hbs-minifier
Usage
ember-hbs-minifier
will remove unnecessary text nodes from your templates
and collapse whitespace into single space characters. This is all done
automatically for you (without having to use e.g. {{~foo~}}
) but is
disabled for certain situations:
Please note that this does not work across component/template boundaries.
What happens in particular is:
Configuration
If you want to disable the whitespace stripping behavior for other tags,
components, or elements with certain CSS classes you can adjust the default
configuration in your ember-cli-build.js
file:
let app = new EmberApp({
'ember-hbs-minifier': {
skip: {
classes: [],
elements: ['pre'],
components: ['no-minify'],
},
},
});
License
ember-hbs-minifier is developed by and ©
simplabs GmbH and contributors. It is released under the
MIT License.