Injectify condition
Remove conditional code from template
Install
npm install --save-dev injectify-condition
Usage
Configure gulp
:
var gulp = browserify = source = ; gulp;
And write some template
{{#is-mobile}} This template will be rendered{{else}} This code will be removed{{/is-mobile}}
You can pass helper to if
and unless
statements
{{#unless (is-mobile)}} This code will be removed for is-mobile=true{{/unless}}
You can pass variables as params and hashes to helpers
{{my-awesome-helper (is-desktop) touch=(is-mobile)}} will be transform into {{my-awesome-helper false touch=true}}
Webpack
moduleexports = module: loaders: test: /\.hbs/ loader: 'injectify' query: JSON