How do I precompile templates?


#1

Hello. I’ve got an Ember app that’s about 700 Kb in production environment. What I don’t understand is, is it already using precompiled templates? Or can I further decrease the size by using a precompiler?

I’ve got Ember Cli 0.1.3, Ember 1.9.0 and I have installed ember-cli-htmlbars, handblebars#2.0.0 and broccoli-emblem-compiler, from here https://github.com/antramm/broccoli-emblem-compiler

So, are my templates precompiled? Or do I need to add something in Brocfile, to use the emblem compiler? I’m a bit confused, and an example would be awesome.

Are there any other strategies for decreasing the size of an Ember App built with CLI? Thank you.


#2

If you don’t have uglify-js plugin installed add it to your project(doesn’t come by default with ember-cli). That should definitely bring down the size of your generated files.


#3

If you open the project-name.js file you should see your templates are represented as javascript functions. If you do indeed see this -you are using precompiled templates. I’m using ember-cli 0.1.3 and 0.1.4 and both seem to function as if I was doing a precompile myself w/ grunt or gulp