How to render a precompile templates with gulp-handlerbars?


#1

Hello everybody I’m try to understand what is the process to precompilete templates, so I use this process to precompilate the templates with gulpjs: https://github.com/lazd/gulp-handlebars/tree/master/examples/ember, I dont get any problem all is ok!.

For example I’ve a template called index.hbs with the content “hello world”, in my index.html (entry point) I’ve the following

<html>
    <head>
        <meta charset="utf-8" />
        <script src="js/vendors.js"></script>
    </head>
    <body>
        <script src="js/templates.js"></script>
        <script src="js/main.js"></script>
    </body>
</html>

And the templates.js is:

this["Ember"] = this["Ember"] || {};
this["Ember"]["TEMPLATES"] = this["Ember"]["TEMPLATES"] || {};
this["Ember"]["TEMPLATES"]["app"] = this["Ember"]["TEMPLATES"]["app"] || {};
this["Ember"]["TEMPLATES"]["app"]["templates"] = this["Ember"]["TEMPLATES"]["app"]["templates"] || {};
this["Ember"]["TEMPLATES"]["app"]["templates"]["index"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data
/**/) {
this.compilerInfo = [4,'>= 1.0.0'];
helpers = this.merge(helpers, Ember.Handlebars.helpers); data = data || {};
    data.buffer.push("hello world.\n");

});

So, I don’t know how to render it, it would be magic?, just put <script src="js/templates.js"></script> and it render it ?

how to render the precompiled templates?