Skip to content
Ember templates trimmer ast transform
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
addon
app
config
lib
tests
vendor
.editorconfig
.ember-cli
.eslintignore
.eslintrc.js
.gitignore
.npmignore
.template-lintrc.js
.travis.yml
.watchmanconfig
CONTRIBUTING.md
LICENSE.md
README.md
ember-cli-build.js
index.js
package-lock.json
package.json
testem.js
yarn.lock

README.md

ember-cli-template-trimmer

This addon removes newlines on compile stage, for cases like this:

<div>
  <div>
    <div>
      <div></div>
    </div>
  </div>
</div>

to this:

<div><div><div><div></div></div></div></div>

* any text nodes inside <pre>, <code> will be saved.

** single space nodes will be saved.

** text nodes having text + (newlines || spaces) will be saved


why?


this reduces glimmer-vm opcodes count, memory usage, and increase final rendering/rerendering speed.


Bonus:

{{#if false}}
    this dead block will be removed at all 
{{/if}}

* This addon DON'T modify nodes (including text content), it only remove matched.

Stats fom one of my projects (gzipped results):

template-trimmer: 150.42 -> 144.92 kb
ember-hbs-minifier: 150.42 -> 144.96 kb
template-trimmer + ember-hbs-minifier: 150.42 -> 144.71 kb


Can I use it with ember-hbs-minifier?

  • Yes

Compatibility

  • Ember.js v2.18 or above
  • Ember CLI v2.13 or above
  • Node.js v8 or above

Installation

ember install ember-cli-template-trimmer

Usage

[Longer description of how to use the addon in apps.]

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

You can’t perform that action at this time.