mercredi 5 août 2015

Ember.js precompiler without node on production environment

I try to use the ember precompiler as described here. I just want to precompile in my development process and deploy everything to my production environment where there is no node.js server.

When I include the generated js - files for all my compiled templates I get these errors in console: SyntaxError: missing declaration after 'export' keyword

This is a example of my fu.js - file, compiled from fu.hbs.

export default Ember.HTMLBars.template((function() {
  return {
    meta: {
      "revision": "Ember@1.13.3",
      "loc": {
        "source": null,
        "start": {
          "line": 1,
          "column": 0
        },
        "end": {
          "line": 1,
          "column": 10
        }
      }
    },
    arity: 0,
    cachedFragment: null,
    hasRendered: false,
    buildFragment: function buildFragment(dom) {
      var el0 = dom.createDocumentFragment();
      var el1 = dom.createTextNode("Hello Fufu");
      dom.appendChild(el0, el1);
      return el0;
    },
    buildRenderNodes: function buildRenderNodes() { return []; },
    statements: [

    ],
    locals: [],
    templates: []
  };
}()));

Shouldn't be there a identifier for my hbs? Like "fu.hbs", how are the precompiled templates added to my ember application? Do I just have to reference the js-files inside my index.html with the same name as the templates?

If everything would work, do I still have to put the following stuff into my index.html?

<script type="text/x-handlebars" data-template-name="fu" id="fu">
      Hello Fufu
</script>



Aucun commentaire:

Enregistrer un commentaire