doowb / handlebars-helpers-browserify-example

Example using handlebars-helpers in a web browser with browserify.
https://doowb.github.io/handlebars-helpers-browserify-example
MIT License
16 stars 5 forks source link

How to browserify only certain helpers or categories #1

Closed markcarey closed 7 years ago

markcarey commented 7 years ago

I used the method described in their example and ended up with a 2.3MB .js file that needs to be loaded by the browser. Obviously a non-starter. I know that I could minify that to reduce the size, but is there a way to only build a subset of helpers?

doowb commented 7 years ago

You can require in a collection directly by doing var arrayHelpers = require('handlebars-helpers/lib/array.js'). Some of the common pieces of code will still be loaded, but this will reduce the size and when used with minify it'll even be better.