Skip to content

Instantly share code, notes, and snippets.

@chancancode chancancode/0-application.hbs Secret
Last active Sep 20, 2016

Embed
What would you like to do?
Ember Templates (2.8 vs 2.9)
Hello {{name}}! {{#if isFriday}}Happy Friday!!!{{/if}}
(function() {
var child0 = (function() {
return {
meta: {
"revision": "Ember@2.8.0",
"loc": {
"source": null,
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 47
}
},
"moduleName": "my-app/templates/application.hbs"
},
isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
var el1 = dom.createTextNode("Happy Friday!!!");
dom.appendChild(el0, el1);
return el0;
},
buildRenderNodes: function buildRenderNodes() { return []; },
statements: [
],
locals: [],
templates: []
};
}());
return {
meta: {
"revision": "Ember@2.8.0",
"loc": {
"source": null,
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 2,
"column": 0
}
},
"moduleName": "my-app/templates/application.hbs"
},
isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
var el1 = dom.createTextNode("Hello ");
dom.appendChild(el0, el1);
var el1 = dom.createComment("");
dom.appendChild(el0, el1);
var el1 = dom.createTextNode("! ");
dom.appendChild(el0, el1);
var el1 = dom.createComment("");
dom.appendChild(el0, el1);
var el1 = dom.createTextNode("\n");
dom.appendChild(el0, el1);
return el0;
},
buildRenderNodes: function buildRenderNodes(dom, fragment, contextualElement) {
var morphs = new Array(2);
morphs[0] = dom.createMorphAt(fragment,1,1,contextualElement);
morphs[1] = dom.createMorphAt(fragment,3,3,contextualElement);
return morphs;
},
statements: [
["content","name",["loc",[null,[1,6],[1,14]]],0,0,0,0],
["block","if",[["get","isFriday",["loc",[null,[1,22],[1,30]]],0,0,0,0]],[],0,null,["loc",[null,[1,16],[1,54]]]]
],
locals: [],
templates: [child0]
};
}())
!function(){var a=function(){return{meta:{revision:"Ember@2.8.0",loc:{source:null,start:{line:1,column:16},end:{line:1,column:47}},moduleName:"my-app/templates/application.hbs"},isEmpty:!1,arity:0,cachedFragment:null,hasRendered:!1,buildFragment:function(a){var b=a.createDocumentFragment(),c=a.createTextNode("Happy Friday!!!");return a.appendChild(b,c),b},buildRenderNodes:function(){return[]},statements:[],locals:[],templates:[]}}();return{meta:{revision:"Ember@2.8.0",loc:{source:null,start:{line:1,column:0},end:{line:2,column:0}},moduleName:"my-app/templates/application.hbs"},isEmpty:!1,arity:0,cachedFragment:null,hasRendered:!1,buildFragment:function(a){var b=a.createDocumentFragment(),c=a.createTextNode("Hello ");a.appendChild(b,c);var c=a.createComment("");a.appendChild(b,c);var c=a.createTextNode("! ");a.appendChild(b,c);var c=a.createComment("");a.appendChild(b,c);var c=a.createTextNode("\n");return a.appendChild(b,c),b},buildRenderNodes:function(a,b,c){var d=new Array(2);return d[0]=a.createMorphAt(b,1,1,c),d[1]=a.createMorphAt(b,3,3,c),d},statements:[["content","name",["loc",[null,[1,6],[1,14]]],0,0,0,0],["block","if",[["get","isFriday",["loc",[null,[1,22],[1,30]]],0,0,0,0]],[],0,null,["loc",[null,[1,16],[1,54]]]]],locals:[],templates:[a]}}();
{"id":null,"block":"{\"statements\":[[\"text\",\"Hello \"],[\"append\",[\"unknown\",[\"name\"]],false],[\"text\",\"! \"],[\"block\",[\"if\"],[[\"get\",[\"isFriday\"]]],null,0],[\"text\",\"\\n\"]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[{\"statements\":[[\"text\",\"Happy Friday!!!\"]],\"locals\":[]}]}","meta":{"moduleName":"my-app/templates/application.hbs"}}
{id:null,block:'{"statements":[["text","Hello "],["append",["unknown",["name"]],false],["text","! "],["block",["if"],[["get",["isFriday"]]],null,0],["text","\\n"]],"locals":[],"named":[],"yields":[],"blocks":[{"statements":[["text","Happy Friday!!!"]],"locals":[]}]}',meta:{moduleName:"my-app/templates/application.hbs"}};
@HeroicEric

This comment has been minimized.

Copy link

HeroicEric commented Sep 9, 2016

If anybody is interested, here's a pretty printed version of the 2.9 (not minified):

{
  "id": null,
  "block": {
    "statements": [
      ["text", "Hello "],
      ["append", ["unknown", ["name"]], false],
      ["text", "! "],
      ["block", ["if"], [["get", ["isFriday"]]], null, 0],
      ["text", "\n"]
    ],
    "locals": [],
    "named": [],
    "yields": [],
    "blocks": [{
      "statements": [["text","Happy Friday!!!"]],
      "locals": []
    }]
  },
  "meta":{
    "moduleName": "my-appgtemplatesapplication.hbs"
  }
}
@devinrhode2

This comment has been minimized.

Copy link

devinrhode2 commented Sep 12, 2016

...And here's the pretty-printed minified version

{
  id: null,
  block: '{
    "statements": [
      ["text", "Hello "],
      ["append", ["unknown", ["name"]], false],
      ["text", "! "],
      ["block", ["if"], [["get", ["isFriday"]]], null, 0],
      ["text", "\\n"]
    ],
    "locals": [],
    "named": [],
    "yields": [],
    "blocks": [{
      "statements": [["text","Happy Friday!!!"]],
      "locals":[]
    }]
  }',
  meta: {
    moduleName: "my-app/templates/application.hbs"
  }
};

...and without the value for the top level block value wrapped in quotes

{
  id: null,
  block: {
    "statements": [
      ["text", "Hello "],
      ["append", ["unknown", ["name"]], false],
      ["text", "! "],
      ["block", ["if"], [["get", ["isFriday"]]], null, 0],
      ["text", "\\n"]
    ],
    "locals": [],
    "named": [],
    "yields": [],
    "blocks": [{
      "statements": [["text","Happy Friday!!!"]],
      "locals":[]
    }]
  },
  meta: {
    moduleName: "my-app/templates/application.hbs"
  }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.