├── .gitignore ├── js ├── helpers │ └── calculateAge.js ├── myTemplate.hbs ├── main.js └── main-bundled.js ├── package.json ├── index.html ├── webpack.config.js ├── README.md └── css └── styles.css /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /js/helpers/calculateAge.js: -------------------------------------------------------------------------------- 1 | module.exports = function(birthYear) { 2 | var age = new Date().getFullYear() - birthYear; 3 | 4 | if (age > 0) { 5 | return age + " years old"; 6 | } else { 7 | return "Less than a year old"; 8 | } 9 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "brads-handlebars-workflow", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "handlebars": "^4.0.10", 13 | "handlebars-loader": "^1.5.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |Age: {{calculateAge birthYear}}
11 | 12 | {{#if favFoods}} 13 |Age: " 388 | + alias2(__default(__webpack_require__(4)).call(alias3,(depth0 != null ? depth0.birthYear : depth0),{"name":"calculateAge","hash":{},"data":data})) 389 | + "
\n\n" 390 | + ((stack1 = helpers["if"].call(alias3,(depth0 != null ? depth0.favFoods : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") 391 | + "\n