#77 Optimize Ember Templates

Emad Ibrahim
1 min readSep 15, 2016

--

I have to admit that it never crossed my mind to optimize my ember app by changing how I create my templates until I read this article.

Here is just one simple example from the article:

If you rewrite:

<p class=”instructions1">{{instructionsOne}}</p>
{{#if instructionsTwo}}
<p class=”instructions2">{{instructionsTwo}}</p>
{{/if}}

like this:

<p class=”instructions1">{{instructionsOne}}</p>
<p class=”instructions2 {{unless instructionsTwo ‘hide’}}”>{{instructionsTwo}}</p>

Your app size goes from 3.8kb to 1.2kb — WOW!!! Multiply that by the number of if statements in your templates and you can see the benefit. Pretty cool!!!

Originally published at Ember Daily Tips.

--

--

Emad Ibrahim

Husband, Father of Twins, Published Author, Entrepreneur, Passionate Technologist, Programmer and Productivity Nut. more at https://about.me/eibrahim