diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fd4f2b0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+node_modules
+.DS_Store
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..074aaf4
--- /dev/null
+++ b/README.md
@@ -0,0 +1,9 @@
+# Common Chunks for handlebars-loader
+
+## Run the example
+
+```bash
+$ npm install
+$ webpack
+$ open index.html
+```
diff --git a/dist/bundle-with-hbs.js b/dist/bundle-with-hbs.js
new file mode 100644
index 0000000..3db52fd
--- /dev/null
+++ b/dist/bundle-with-hbs.js
@@ -0,0 +1,819 @@
+webpackJsonp([2,3],[
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var mainTemp = __webpack_require__(2);
+
+ document.querySelector('.main').innerHTML = mainTemp({file: 'MAIN'});
+
+
+/***/ },
+/* 1 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
+
+ exports.__esModule = true;
+
+ var _import = __webpack_require__(6);
+
+ var base = _interopRequireWildcard(_import);
+
+ // Each of these augment the Handlebars object. No need to setup here.
+ // (This is done to easily share code between commonjs and browse envs)
+
+ var _SafeString = __webpack_require__(7);
+
+ var _SafeString2 = _interopRequireWildcard(_SafeString);
+
+ var _Exception = __webpack_require__(8);
+
+ var _Exception2 = _interopRequireWildcard(_Exception);
+
+ var _import2 = __webpack_require__(5);
+
+ var Utils = _interopRequireWildcard(_import2);
+
+ var _import3 = __webpack_require__(9);
+
+ var runtime = _interopRequireWildcard(_import3);
+
+ var _noConflict = __webpack_require__(10);
+
+ var _noConflict2 = _interopRequireWildcard(_noConflict);
+
+ // For compatibility and usage outside of module systems, make the Handlebars object a namespace
+ function create() {
+ var hb = new base.HandlebarsEnvironment();
+
+ Utils.extend(hb, base);
+ hb.SafeString = _SafeString2['default'];
+ hb.Exception = _Exception2['default'];
+ hb.Utils = Utils;
+ hb.escapeExpression = Utils.escapeExpression;
+
+ hb.VM = runtime;
+ hb.template = function (spec) {
+ return runtime.template(spec, hb);
+ };
+
+ return hb;
+ }
+
+ var inst = create();
+ inst.create = create;
+
+ _noConflict2['default'](inst);
+
+ inst['default'] = inst;
+
+ exports['default'] = inst;
+ module.exports = exports['default'];
+
+/***/ },
+/* 2 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var Handlebars = __webpack_require__(4);
+ module.exports = (Handlebars["default"] || Handlebars).template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var helper;
+
+ return "
I come from the main bundle "
+ + this.escapeExpression(((helper = (helper = helpers.file || (depth0 != null ? depth0.file : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0,{"name":"file","hash":{},"data":data}) : helper)))
+ + ".hbs
\n";
+ },"useData":true});
+
+/***/ },
+/* 3 */,
+/* 4 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // Create a simple path alias to allow browserify to resolve
+ // the runtime on a supported path.
+ module.exports = __webpack_require__(1)['default'];
+
+
+/***/ },
+/* 5 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+ exports.extend = extend;
+
+ // Older IE versions do not directly support indexOf so we must implement our own, sadly.
+ exports.indexOf = indexOf;
+ exports.escapeExpression = escapeExpression;
+ exports.isEmpty = isEmpty;
+ exports.blockParams = blockParams;
+ exports.appendContextPath = appendContextPath;
+ var escape = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ '\'': ''',
+ '`': '`'
+ };
+
+ var badChars = /[&<>"'`]/g,
+ possible = /[&<>"'`]/;
+
+ function escapeChar(chr) {
+ return escape[chr];
+ }
+
+ function extend(obj /* , ...source */) {
+ for (var i = 1; i < arguments.length; i++) {
+ for (var key in arguments[i]) {
+ if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
+ obj[key] = arguments[i][key];
+ }
+ }
+ }
+
+ return obj;
+ }
+
+ var toString = Object.prototype.toString;
+
+ exports.toString = toString;
+ // Sourced from lodash
+ // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
+ /*eslint-disable func-style, no-var */
+ var isFunction = function isFunction(value) {
+ return typeof value === 'function';
+ };
+ // fallback for older versions of Chrome and Safari
+ /* istanbul ignore next */
+ if (isFunction(/x/)) {
+ exports.isFunction = isFunction = function (value) {
+ return typeof value === 'function' && toString.call(value) === '[object Function]';
+ };
+ }
+ var isFunction;
+ exports.isFunction = isFunction;
+ /*eslint-enable func-style, no-var */
+
+ /* istanbul ignore next */
+ var isArray = Array.isArray || function (value) {
+ return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
+ };exports.isArray = isArray;
+
+ function indexOf(array, value) {
+ for (var i = 0, len = array.length; i < len; i++) {
+ if (array[i] === value) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ function escapeExpression(string) {
+ if (typeof string !== 'string') {
+ // don't escape SafeStrings, since they're already safe
+ if (string && string.toHTML) {
+ return string.toHTML();
+ } else if (string == null) {
+ return '';
+ } else if (!string) {
+ return string + '';
+ }
+
+ // Force a string conversion as this will be done by the append regardless and
+ // the regex test will do this transparently behind the scenes, causing issues if
+ // an object's to string has escaped characters in it.
+ string = '' + string;
+ }
+
+ if (!possible.test(string)) {
+ return string;
+ }
+ return string.replace(badChars, escapeChar);
+ }
+
+ function isEmpty(value) {
+ if (!value && value !== 0) {
+ return true;
+ } else if (isArray(value) && value.length === 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function blockParams(params, ids) {
+ params.path = ids;
+ return params;
+ }
+
+ function appendContextPath(contextPath, id) {
+ return (contextPath ? contextPath + '.' : '') + id;
+ }
+
+/***/ },
+/* 6 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
+
+ exports.__esModule = true;
+ exports.HandlebarsEnvironment = HandlebarsEnvironment;
+ exports.createFrame = createFrame;
+
+ var _import = __webpack_require__(5);
+
+ var Utils = _interopRequireWildcard(_import);
+
+ var _Exception = __webpack_require__(8);
+
+ var _Exception2 = _interopRequireWildcard(_Exception);
+
+ var VERSION = '3.0.1';
+ exports.VERSION = VERSION;
+ var COMPILER_REVISION = 6;
+
+ exports.COMPILER_REVISION = COMPILER_REVISION;
+ var REVISION_CHANGES = {
+ 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
+ 2: '== 1.0.0-rc.3',
+ 3: '== 1.0.0-rc.4',
+ 4: '== 1.x.x',
+ 5: '== 2.0.0-alpha.x',
+ 6: '>= 2.0.0-beta.1'
+ };
+
+ exports.REVISION_CHANGES = REVISION_CHANGES;
+ var isArray = Utils.isArray,
+ isFunction = Utils.isFunction,
+ toString = Utils.toString,
+ objectType = '[object Object]';
+
+ function HandlebarsEnvironment(helpers, partials) {
+ this.helpers = helpers || {};
+ this.partials = partials || {};
+
+ registerDefaultHelpers(this);
+ }
+
+ HandlebarsEnvironment.prototype = {
+ constructor: HandlebarsEnvironment,
+
+ logger: logger,
+ log: log,
+
+ registerHelper: function registerHelper(name, fn) {
+ if (toString.call(name) === objectType) {
+ if (fn) {
+ throw new _Exception2['default']('Arg not supported with multiple helpers');
+ }
+ Utils.extend(this.helpers, name);
+ } else {
+ this.helpers[name] = fn;
+ }
+ },
+ unregisterHelper: function unregisterHelper(name) {
+ delete this.helpers[name];
+ },
+
+ registerPartial: function registerPartial(name, partial) {
+ if (toString.call(name) === objectType) {
+ Utils.extend(this.partials, name);
+ } else {
+ if (typeof partial === 'undefined') {
+ throw new _Exception2['default']('Attempting to register a partial as undefined');
+ }
+ this.partials[name] = partial;
+ }
+ },
+ unregisterPartial: function unregisterPartial(name) {
+ delete this.partials[name];
+ }
+ };
+
+ function registerDefaultHelpers(instance) {
+ instance.registerHelper('helperMissing', function () {
+ if (arguments.length === 1) {
+ // A missing field in a {{foo}} constuct.
+ return undefined;
+ } else {
+ // Someone is actually trying to call something, blow up.
+ throw new _Exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
+ }
+ });
+
+ instance.registerHelper('blockHelperMissing', function (context, options) {
+ var inverse = options.inverse,
+ fn = options.fn;
+
+ if (context === true) {
+ return fn(this);
+ } else if (context === false || context == null) {
+ return inverse(this);
+ } else if (isArray(context)) {
+ if (context.length > 0) {
+ if (options.ids) {
+ options.ids = [options.name];
+ }
+
+ return instance.helpers.each(context, options);
+ } else {
+ return inverse(this);
+ }
+ } else {
+ if (options.data && options.ids) {
+ var data = createFrame(options.data);
+ data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name);
+ options = { data: data };
+ }
+
+ return fn(context, options);
+ }
+ });
+
+ instance.registerHelper('each', function (context, options) {
+ if (!options) {
+ throw new _Exception2['default']('Must pass iterator to #each');
+ }
+
+ var fn = options.fn,
+ inverse = options.inverse,
+ i = 0,
+ ret = '',
+ data = undefined,
+ contextPath = undefined;
+
+ if (options.data && options.ids) {
+ contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
+ }
+
+ if (isFunction(context)) {
+ context = context.call(this);
+ }
+
+ if (options.data) {
+ data = createFrame(options.data);
+ }
+
+ function execIteration(field, index, last) {
+ if (data) {
+ data.key = field;
+ data.index = index;
+ data.first = index === 0;
+ data.last = !!last;
+
+ if (contextPath) {
+ data.contextPath = contextPath + field;
+ }
+ }
+
+ ret = ret + fn(context[field], {
+ data: data,
+ blockParams: Utils.blockParams([context[field], field], [contextPath + field, null])
+ });
+ }
+
+ if (context && typeof context === 'object') {
+ if (isArray(context)) {
+ for (var j = context.length; i < j; i++) {
+ execIteration(i, i, i === context.length - 1);
+ }
+ } else {
+ var priorKey = undefined;
+
+ for (var key in context) {
+ if (context.hasOwnProperty(key)) {
+ // We're running the iterations one step out of sync so we can detect
+ // the last iteration without have to scan the object twice and create
+ // an itermediate keys array.
+ if (priorKey) {
+ execIteration(priorKey, i - 1);
+ }
+ priorKey = key;
+ i++;
+ }
+ }
+ if (priorKey) {
+ execIteration(priorKey, i - 1, true);
+ }
+ }
+ }
+
+ if (i === 0) {
+ ret = inverse(this);
+ }
+
+ return ret;
+ });
+
+ instance.registerHelper('if', function (conditional, options) {
+ if (isFunction(conditional)) {
+ conditional = conditional.call(this);
+ }
+
+ // Default behavior is to render the positive path if the value is truthy and not empty.
+ // The `includeZero` option may be set to treat the condtional as purely not empty based on the
+ // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
+ if (!options.hash.includeZero && !conditional || Utils.isEmpty(conditional)) {
+ return options.inverse(this);
+ } else {
+ return options.fn(this);
+ }
+ });
+
+ instance.registerHelper('unless', function (conditional, options) {
+ return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
+ });
+
+ instance.registerHelper('with', function (context, options) {
+ if (isFunction(context)) {
+ context = context.call(this);
+ }
+
+ var fn = options.fn;
+
+ if (!Utils.isEmpty(context)) {
+ if (options.data && options.ids) {
+ var data = createFrame(options.data);
+ data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]);
+ options = { data: data };
+ }
+
+ return fn(context, options);
+ } else {
+ return options.inverse(this);
+ }
+ });
+
+ instance.registerHelper('log', function (message, options) {
+ var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
+ instance.log(level, message);
+ });
+
+ instance.registerHelper('lookup', function (obj, field) {
+ return obj && obj[field];
+ });
+ }
+
+ var logger = {
+ methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
+
+ // State enum
+ DEBUG: 0,
+ INFO: 1,
+ WARN: 2,
+ ERROR: 3,
+ level: 1,
+
+ // Can be overridden in the host environment
+ log: function log(level, message) {
+ if (typeof console !== 'undefined' && logger.level <= level) {
+ var method = logger.methodMap[level];
+ (console[method] || console.log).call(console, message); // eslint-disable-line no-console
+ }
+ }
+ };
+
+ exports.logger = logger;
+ var log = logger.log;
+
+ exports.log = log;
+
+ function createFrame(object) {
+ var frame = Utils.extend({}, object);
+ frame._parent = object;
+ return frame;
+ }
+
+ /* [args, ]options */
+
+/***/ },
+/* 7 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+ // Build out our basic SafeString type
+ function SafeString(string) {
+ this.string = string;
+ }
+
+ SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
+ return '' + this.string;
+ };
+
+ exports['default'] = SafeString;
+ module.exports = exports['default'];
+
+/***/ },
+/* 8 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+
+ var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
+
+ function Exception(message, node) {
+ var loc = node && node.loc,
+ line = undefined,
+ column = undefined;
+ if (loc) {
+ line = loc.start.line;
+ column = loc.start.column;
+
+ message += ' - ' + line + ':' + column;
+ }
+
+ var tmp = Error.prototype.constructor.call(this, message);
+
+ // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
+ for (var idx = 0; idx < errorProps.length; idx++) {
+ this[errorProps[idx]] = tmp[errorProps[idx]];
+ }
+
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, Exception);
+ }
+
+ if (loc) {
+ this.lineNumber = line;
+ this.column = column;
+ }
+ }
+
+ Exception.prototype = new Error();
+
+ exports['default'] = Exception;
+ module.exports = exports['default'];
+
+/***/ },
+/* 9 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
+
+ exports.__esModule = true;
+ exports.checkRevision = checkRevision;
+
+ // TODO: Remove this line and break up compilePartial
+
+ exports.template = template;
+ exports.wrapProgram = wrapProgram;
+ exports.resolvePartial = resolvePartial;
+ exports.invokePartial = invokePartial;
+ exports.noop = noop;
+
+ var _import = __webpack_require__(5);
+
+ var Utils = _interopRequireWildcard(_import);
+
+ var _Exception = __webpack_require__(8);
+
+ var _Exception2 = _interopRequireWildcard(_Exception);
+
+ var _COMPILER_REVISION$REVISION_CHANGES$createFrame = __webpack_require__(6);
+
+ function checkRevision(compilerInfo) {
+ var compilerRevision = compilerInfo && compilerInfo[0] || 1,
+ currentRevision = _COMPILER_REVISION$REVISION_CHANGES$createFrame.COMPILER_REVISION;
+
+ if (compilerRevision !== currentRevision) {
+ if (compilerRevision < currentRevision) {
+ var runtimeVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[currentRevision],
+ compilerVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[compilerRevision];
+ throw new _Exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').');
+ } else {
+ // Use the embedded version info since the runtime doesn't know about this revision yet
+ throw new _Exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').');
+ }
+ }
+ }
+
+ function template(templateSpec, env) {
+ /* istanbul ignore next */
+ if (!env) {
+ throw new _Exception2['default']('No environment passed to template');
+ }
+ if (!templateSpec || !templateSpec.main) {
+ throw new _Exception2['default']('Unknown template object: ' + typeof templateSpec);
+ }
+
+ // Note: Using env.VM references rather than local var references throughout this section to allow
+ // for external users to override these as psuedo-supported APIs.
+ env.VM.checkRevision(templateSpec.compiler);
+
+ function invokePartialWrapper(partial, context, options) {
+ if (options.hash) {
+ context = Utils.extend({}, context, options.hash);
+ }
+
+ partial = env.VM.resolvePartial.call(this, partial, context, options);
+ var result = env.VM.invokePartial.call(this, partial, context, options);
+
+ if (result == null && env.compile) {
+ options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
+ result = options.partials[options.name](context, options);
+ }
+ if (result != null) {
+ if (options.indent) {
+ var lines = result.split('\n');
+ for (var i = 0, l = lines.length; i < l; i++) {
+ if (!lines[i] && i + 1 === l) {
+ break;
+ }
+
+ lines[i] = options.indent + lines[i];
+ }
+ result = lines.join('\n');
+ }
+ return result;
+ } else {
+ throw new _Exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
+ }
+ }
+
+ // Just add water
+ var container = {
+ strict: function strict(obj, name) {
+ if (!(name in obj)) {
+ throw new _Exception2['default']('"' + name + '" not defined in ' + obj);
+ }
+ return obj[name];
+ },
+ lookup: function lookup(depths, name) {
+ var len = depths.length;
+ for (var i = 0; i < len; i++) {
+ if (depths[i] && depths[i][name] != null) {
+ return depths[i][name];
+ }
+ }
+ },
+ lambda: function lambda(current, context) {
+ return typeof current === 'function' ? current.call(context) : current;
+ },
+
+ escapeExpression: Utils.escapeExpression,
+ invokePartial: invokePartialWrapper,
+
+ fn: function fn(i) {
+ return templateSpec[i];
+ },
+
+ programs: [],
+ program: function program(i, data, declaredBlockParams, blockParams, depths) {
+ var programWrapper = this.programs[i],
+ fn = this.fn(i);
+ if (data || depths || blockParams || declaredBlockParams) {
+ programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
+ } else if (!programWrapper) {
+ programWrapper = this.programs[i] = wrapProgram(this, i, fn);
+ }
+ return programWrapper;
+ },
+
+ data: function data(value, depth) {
+ while (value && depth--) {
+ value = value._parent;
+ }
+ return value;
+ },
+ merge: function merge(param, common) {
+ var obj = param || common;
+
+ if (param && common && param !== common) {
+ obj = Utils.extend({}, common, param);
+ }
+
+ return obj;
+ },
+
+ noop: env.VM.noop,
+ compilerInfo: templateSpec.compiler
+ };
+
+ function ret(context) {
+ var options = arguments[1] === undefined ? {} : arguments[1];
+
+ var data = options.data;
+
+ ret._setup(options);
+ if (!options.partial && templateSpec.useData) {
+ data = initData(context, data);
+ }
+ var depths = undefined,
+ blockParams = templateSpec.useBlockParams ? [] : undefined;
+ if (templateSpec.useDepths) {
+ depths = options.depths ? [context].concat(options.depths) : [context];
+ }
+
+ return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
+ }
+ ret.isTop = true;
+
+ ret._setup = function (options) {
+ if (!options.partial) {
+ container.helpers = container.merge(options.helpers, env.helpers);
+
+ if (templateSpec.usePartial) {
+ container.partials = container.merge(options.partials, env.partials);
+ }
+ } else {
+ container.helpers = options.helpers;
+ container.partials = options.partials;
+ }
+ };
+
+ ret._child = function (i, data, blockParams, depths) {
+ if (templateSpec.useBlockParams && !blockParams) {
+ throw new _Exception2['default']('must pass block params');
+ }
+ if (templateSpec.useDepths && !depths) {
+ throw new _Exception2['default']('must pass parent depths');
+ }
+
+ return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
+ };
+ return ret;
+ }
+
+ function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
+ function prog(context) {
+ var options = arguments[1] === undefined ? {} : arguments[1];
+
+ return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths));
+ }
+ prog.program = i;
+ prog.depth = depths ? depths.length : 0;
+ prog.blockParams = declaredBlockParams || 0;
+ return prog;
+ }
+
+ function resolvePartial(partial, context, options) {
+ if (!partial) {
+ partial = options.partials[options.name];
+ } else if (!partial.call && !options.name) {
+ // This is a dynamic partial that returned a string
+ options.name = partial;
+ partial = options.partials[partial];
+ }
+ return partial;
+ }
+
+ function invokePartial(partial, context, options) {
+ options.partial = true;
+
+ if (partial === undefined) {
+ throw new _Exception2['default']('The partial ' + options.name + ' could not be found');
+ } else if (partial instanceof Function) {
+ return partial(context, options);
+ }
+ }
+
+ function noop() {
+ return '';
+ }
+
+ function initData(context, data) {
+ if (!data || !('root' in data)) {
+ data = data ? _COMPILER_REVISION$REVISION_CHANGES$createFrame.createFrame(data) : {};
+ data.root = context;
+ }
+ return data;
+ }
+
+/***/ },
+/* 10 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* WEBPACK VAR INJECTION */(function(global) {'use strict';
+
+ exports.__esModule = true;
+ /*global window */
+
+ exports['default'] = function (Handlebars) {
+ /* istanbul ignore next */
+ var root = typeof global !== 'undefined' ? global : window,
+ $Handlebars = root.Handlebars;
+ /* istanbul ignore next */
+ Handlebars.noConflict = function () {
+ if (root.Handlebars === Handlebars) {
+ root.Handlebars = $Handlebars;
+ }
+ };
+ };
+
+ module.exports = exports['default'];
+ /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
+
+/***/ }
+]);
\ No newline at end of file
diff --git a/dist/commons.js b/dist/commons.js
new file mode 100644
index 0000000..ec60e60
--- /dev/null
+++ b/dist/commons.js
@@ -0,0 +1,94 @@
+/******/ (function(modules) { // webpackBootstrap
+/******/ // install a JSONP callback for chunk loading
+/******/ var parentJsonpFunction = window["webpackJsonp"];
+/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
+/******/ // add "moreModules" to the modules object,
+/******/ // then flag all "chunkIds" as loaded and fire callback
+/******/ var moduleId, chunkId, i = 0, callbacks = [];
+/******/ for(;i < chunkIds.length; i++) {
+/******/ chunkId = chunkIds[i];
+/******/ if(installedChunks[chunkId])
+/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]);
+/******/ installedChunks[chunkId] = 0;
+/******/ }
+/******/ for(moduleId in moreModules) {
+/******/ modules[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);
+/******/ while(callbacks.length)
+/******/ callbacks.shift().call(null, __webpack_require__);
+/******/ if(moreModules[0]) {
+/******/ installedModules[0] = 0;
+/******/ return __webpack_require__(0);
+/******/ }
+/******/ };
+
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // object to store loaded and loading chunks
+/******/ // "0" means "already loaded"
+/******/ // Array means "loading", array contains callbacks
+/******/ var installedChunks = {
+/******/ 3:0
+/******/ };
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+/******/ // This file contains only the entry chunk.
+/******/ // The chunk loading function for additional chunks
+/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) {
+/******/ // "0" is the signal for "already loaded"
+/******/ if(installedChunks[chunkId] === 0)
+/******/ return callback.call(null, __webpack_require__);
+
+/******/ // an array means "currently loading".
+/******/ if(installedChunks[chunkId] !== undefined) {
+/******/ installedChunks[chunkId].push(callback);
+/******/ } else {
+/******/ // start chunk loading
+/******/ installedChunks[chunkId] = [callback];
+/******/ var head = document.getElementsByTagName('head')[0];
+/******/ var script = document.createElement('script');
+/******/ script.type = 'text/javascript';
+/******/ script.charset = 'utf-8';
+/******/ script.async = true;
+
+/******/ script.src = __webpack_require__.p + "" + chunkId + "." + ({"0":"no-hbs","1":"with-hbs","2":"bundle-with-hbs"}[chunkId]||chunkId) + ".js";
+/******/ head.appendChild(script);
+/******/ }
+/******/ };
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+/******/ })
+/************************************************************************/
+/******/ ([]);
\ No newline at end of file
diff --git a/dist/no-hbs.js b/dist/no-hbs.js
new file mode 100644
index 0000000..4e623e5
--- /dev/null
+++ b/dist/no-hbs.js
@@ -0,0 +1,9 @@
+webpackJsonp([0,3],[
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
+
+ console.log('I don\'t do anything!!');
+
+
+/***/ }
+]);
\ No newline at end of file
diff --git a/dist/with-hbs.js b/dist/with-hbs.js
new file mode 100644
index 0000000..b7cd33b
--- /dev/null
+++ b/dist/with-hbs.js
@@ -0,0 +1,819 @@
+webpackJsonp([1,3],[
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var bTemp = __webpack_require__(3);
+
+ document.querySelector('.b').innerHTML = bTemp({file: 'B'});
+
+
+/***/ },
+/* 1 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
+
+ exports.__esModule = true;
+
+ var _import = __webpack_require__(6);
+
+ var base = _interopRequireWildcard(_import);
+
+ // Each of these augment the Handlebars object. No need to setup here.
+ // (This is done to easily share code between commonjs and browse envs)
+
+ var _SafeString = __webpack_require__(7);
+
+ var _SafeString2 = _interopRequireWildcard(_SafeString);
+
+ var _Exception = __webpack_require__(8);
+
+ var _Exception2 = _interopRequireWildcard(_Exception);
+
+ var _import2 = __webpack_require__(5);
+
+ var Utils = _interopRequireWildcard(_import2);
+
+ var _import3 = __webpack_require__(9);
+
+ var runtime = _interopRequireWildcard(_import3);
+
+ var _noConflict = __webpack_require__(10);
+
+ var _noConflict2 = _interopRequireWildcard(_noConflict);
+
+ // For compatibility and usage outside of module systems, make the Handlebars object a namespace
+ function create() {
+ var hb = new base.HandlebarsEnvironment();
+
+ Utils.extend(hb, base);
+ hb.SafeString = _SafeString2['default'];
+ hb.Exception = _Exception2['default'];
+ hb.Utils = Utils;
+ hb.escapeExpression = Utils.escapeExpression;
+
+ hb.VM = runtime;
+ hb.template = function (spec) {
+ return runtime.template(spec, hb);
+ };
+
+ return hb;
+ }
+
+ var inst = create();
+ inst.create = create;
+
+ _noConflict2['default'](inst);
+
+ inst['default'] = inst;
+
+ exports['default'] = inst;
+ module.exports = exports['default'];
+
+/***/ },
+/* 2 */,
+/* 3 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var Handlebars = __webpack_require__(4);
+ module.exports = (Handlebars["default"] || Handlebars).template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var helper;
+
+ return "I come from "
+ + this.escapeExpression(((helper = (helper = helpers.file || (depth0 != null ? depth0.file : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0,{"name":"file","hash":{},"data":data}) : helper)))
+ + ".hbs
\n\n";
+ },"useData":true});
+
+/***/ },
+/* 4 */
+/***/ function(module, exports, __webpack_require__) {
+
+ // Create a simple path alias to allow browserify to resolve
+ // the runtime on a supported path.
+ module.exports = __webpack_require__(1)['default'];
+
+
+/***/ },
+/* 5 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+ exports.extend = extend;
+
+ // Older IE versions do not directly support indexOf so we must implement our own, sadly.
+ exports.indexOf = indexOf;
+ exports.escapeExpression = escapeExpression;
+ exports.isEmpty = isEmpty;
+ exports.blockParams = blockParams;
+ exports.appendContextPath = appendContextPath;
+ var escape = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ '\'': ''',
+ '`': '`'
+ };
+
+ var badChars = /[&<>"'`]/g,
+ possible = /[&<>"'`]/;
+
+ function escapeChar(chr) {
+ return escape[chr];
+ }
+
+ function extend(obj /* , ...source */) {
+ for (var i = 1; i < arguments.length; i++) {
+ for (var key in arguments[i]) {
+ if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
+ obj[key] = arguments[i][key];
+ }
+ }
+ }
+
+ return obj;
+ }
+
+ var toString = Object.prototype.toString;
+
+ exports.toString = toString;
+ // Sourced from lodash
+ // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
+ /*eslint-disable func-style, no-var */
+ var isFunction = function isFunction(value) {
+ return typeof value === 'function';
+ };
+ // fallback for older versions of Chrome and Safari
+ /* istanbul ignore next */
+ if (isFunction(/x/)) {
+ exports.isFunction = isFunction = function (value) {
+ return typeof value === 'function' && toString.call(value) === '[object Function]';
+ };
+ }
+ var isFunction;
+ exports.isFunction = isFunction;
+ /*eslint-enable func-style, no-var */
+
+ /* istanbul ignore next */
+ var isArray = Array.isArray || function (value) {
+ return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false;
+ };exports.isArray = isArray;
+
+ function indexOf(array, value) {
+ for (var i = 0, len = array.length; i < len; i++) {
+ if (array[i] === value) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ function escapeExpression(string) {
+ if (typeof string !== 'string') {
+ // don't escape SafeStrings, since they're already safe
+ if (string && string.toHTML) {
+ return string.toHTML();
+ } else if (string == null) {
+ return '';
+ } else if (!string) {
+ return string + '';
+ }
+
+ // Force a string conversion as this will be done by the append regardless and
+ // the regex test will do this transparently behind the scenes, causing issues if
+ // an object's to string has escaped characters in it.
+ string = '' + string;
+ }
+
+ if (!possible.test(string)) {
+ return string;
+ }
+ return string.replace(badChars, escapeChar);
+ }
+
+ function isEmpty(value) {
+ if (!value && value !== 0) {
+ return true;
+ } else if (isArray(value) && value.length === 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function blockParams(params, ids) {
+ params.path = ids;
+ return params;
+ }
+
+ function appendContextPath(contextPath, id) {
+ return (contextPath ? contextPath + '.' : '') + id;
+ }
+
+/***/ },
+/* 6 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
+
+ exports.__esModule = true;
+ exports.HandlebarsEnvironment = HandlebarsEnvironment;
+ exports.createFrame = createFrame;
+
+ var _import = __webpack_require__(5);
+
+ var Utils = _interopRequireWildcard(_import);
+
+ var _Exception = __webpack_require__(8);
+
+ var _Exception2 = _interopRequireWildcard(_Exception);
+
+ var VERSION = '3.0.1';
+ exports.VERSION = VERSION;
+ var COMPILER_REVISION = 6;
+
+ exports.COMPILER_REVISION = COMPILER_REVISION;
+ var REVISION_CHANGES = {
+ 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
+ 2: '== 1.0.0-rc.3',
+ 3: '== 1.0.0-rc.4',
+ 4: '== 1.x.x',
+ 5: '== 2.0.0-alpha.x',
+ 6: '>= 2.0.0-beta.1'
+ };
+
+ exports.REVISION_CHANGES = REVISION_CHANGES;
+ var isArray = Utils.isArray,
+ isFunction = Utils.isFunction,
+ toString = Utils.toString,
+ objectType = '[object Object]';
+
+ function HandlebarsEnvironment(helpers, partials) {
+ this.helpers = helpers || {};
+ this.partials = partials || {};
+
+ registerDefaultHelpers(this);
+ }
+
+ HandlebarsEnvironment.prototype = {
+ constructor: HandlebarsEnvironment,
+
+ logger: logger,
+ log: log,
+
+ registerHelper: function registerHelper(name, fn) {
+ if (toString.call(name) === objectType) {
+ if (fn) {
+ throw new _Exception2['default']('Arg not supported with multiple helpers');
+ }
+ Utils.extend(this.helpers, name);
+ } else {
+ this.helpers[name] = fn;
+ }
+ },
+ unregisterHelper: function unregisterHelper(name) {
+ delete this.helpers[name];
+ },
+
+ registerPartial: function registerPartial(name, partial) {
+ if (toString.call(name) === objectType) {
+ Utils.extend(this.partials, name);
+ } else {
+ if (typeof partial === 'undefined') {
+ throw new _Exception2['default']('Attempting to register a partial as undefined');
+ }
+ this.partials[name] = partial;
+ }
+ },
+ unregisterPartial: function unregisterPartial(name) {
+ delete this.partials[name];
+ }
+ };
+
+ function registerDefaultHelpers(instance) {
+ instance.registerHelper('helperMissing', function () {
+ if (arguments.length === 1) {
+ // A missing field in a {{foo}} constuct.
+ return undefined;
+ } else {
+ // Someone is actually trying to call something, blow up.
+ throw new _Exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
+ }
+ });
+
+ instance.registerHelper('blockHelperMissing', function (context, options) {
+ var inverse = options.inverse,
+ fn = options.fn;
+
+ if (context === true) {
+ return fn(this);
+ } else if (context === false || context == null) {
+ return inverse(this);
+ } else if (isArray(context)) {
+ if (context.length > 0) {
+ if (options.ids) {
+ options.ids = [options.name];
+ }
+
+ return instance.helpers.each(context, options);
+ } else {
+ return inverse(this);
+ }
+ } else {
+ if (options.data && options.ids) {
+ var data = createFrame(options.data);
+ data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name);
+ options = { data: data };
+ }
+
+ return fn(context, options);
+ }
+ });
+
+ instance.registerHelper('each', function (context, options) {
+ if (!options) {
+ throw new _Exception2['default']('Must pass iterator to #each');
+ }
+
+ var fn = options.fn,
+ inverse = options.inverse,
+ i = 0,
+ ret = '',
+ data = undefined,
+ contextPath = undefined;
+
+ if (options.data && options.ids) {
+ contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
+ }
+
+ if (isFunction(context)) {
+ context = context.call(this);
+ }
+
+ if (options.data) {
+ data = createFrame(options.data);
+ }
+
+ function execIteration(field, index, last) {
+ if (data) {
+ data.key = field;
+ data.index = index;
+ data.first = index === 0;
+ data.last = !!last;
+
+ if (contextPath) {
+ data.contextPath = contextPath + field;
+ }
+ }
+
+ ret = ret + fn(context[field], {
+ data: data,
+ blockParams: Utils.blockParams([context[field], field], [contextPath + field, null])
+ });
+ }
+
+ if (context && typeof context === 'object') {
+ if (isArray(context)) {
+ for (var j = context.length; i < j; i++) {
+ execIteration(i, i, i === context.length - 1);
+ }
+ } else {
+ var priorKey = undefined;
+
+ for (var key in context) {
+ if (context.hasOwnProperty(key)) {
+ // We're running the iterations one step out of sync so we can detect
+ // the last iteration without have to scan the object twice and create
+ // an itermediate keys array.
+ if (priorKey) {
+ execIteration(priorKey, i - 1);
+ }
+ priorKey = key;
+ i++;
+ }
+ }
+ if (priorKey) {
+ execIteration(priorKey, i - 1, true);
+ }
+ }
+ }
+
+ if (i === 0) {
+ ret = inverse(this);
+ }
+
+ return ret;
+ });
+
+ instance.registerHelper('if', function (conditional, options) {
+ if (isFunction(conditional)) {
+ conditional = conditional.call(this);
+ }
+
+ // Default behavior is to render the positive path if the value is truthy and not empty.
+ // The `includeZero` option may be set to treat the condtional as purely not empty based on the
+ // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
+ if (!options.hash.includeZero && !conditional || Utils.isEmpty(conditional)) {
+ return options.inverse(this);
+ } else {
+ return options.fn(this);
+ }
+ });
+
+ instance.registerHelper('unless', function (conditional, options) {
+ return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash });
+ });
+
+ instance.registerHelper('with', function (context, options) {
+ if (isFunction(context)) {
+ context = context.call(this);
+ }
+
+ var fn = options.fn;
+
+ if (!Utils.isEmpty(context)) {
+ if (options.data && options.ids) {
+ var data = createFrame(options.data);
+ data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]);
+ options = { data: data };
+ }
+
+ return fn(context, options);
+ } else {
+ return options.inverse(this);
+ }
+ });
+
+ instance.registerHelper('log', function (message, options) {
+ var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
+ instance.log(level, message);
+ });
+
+ instance.registerHelper('lookup', function (obj, field) {
+ return obj && obj[field];
+ });
+ }
+
+ var logger = {
+ methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
+
+ // State enum
+ DEBUG: 0,
+ INFO: 1,
+ WARN: 2,
+ ERROR: 3,
+ level: 1,
+
+ // Can be overridden in the host environment
+ log: function log(level, message) {
+ if (typeof console !== 'undefined' && logger.level <= level) {
+ var method = logger.methodMap[level];
+ (console[method] || console.log).call(console, message); // eslint-disable-line no-console
+ }
+ }
+ };
+
+ exports.logger = logger;
+ var log = logger.log;
+
+ exports.log = log;
+
+ function createFrame(object) {
+ var frame = Utils.extend({}, object);
+ frame._parent = object;
+ return frame;
+ }
+
+ /* [args, ]options */
+
+/***/ },
+/* 7 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+ // Build out our basic SafeString type
+ function SafeString(string) {
+ this.string = string;
+ }
+
+ SafeString.prototype.toString = SafeString.prototype.toHTML = function () {
+ return '' + this.string;
+ };
+
+ exports['default'] = SafeString;
+ module.exports = exports['default'];
+
+/***/ },
+/* 8 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+
+ var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
+
+ function Exception(message, node) {
+ var loc = node && node.loc,
+ line = undefined,
+ column = undefined;
+ if (loc) {
+ line = loc.start.line;
+ column = loc.start.column;
+
+ message += ' - ' + line + ':' + column;
+ }
+
+ var tmp = Error.prototype.constructor.call(this, message);
+
+ // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
+ for (var idx = 0; idx < errorProps.length; idx++) {
+ this[errorProps[idx]] = tmp[errorProps[idx]];
+ }
+
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, Exception);
+ }
+
+ if (loc) {
+ this.lineNumber = line;
+ this.column = column;
+ }
+ }
+
+ Exception.prototype = new Error();
+
+ exports['default'] = Exception;
+ module.exports = exports['default'];
+
+/***/ },
+/* 9 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
+
+ exports.__esModule = true;
+ exports.checkRevision = checkRevision;
+
+ // TODO: Remove this line and break up compilePartial
+
+ exports.template = template;
+ exports.wrapProgram = wrapProgram;
+ exports.resolvePartial = resolvePartial;
+ exports.invokePartial = invokePartial;
+ exports.noop = noop;
+
+ var _import = __webpack_require__(5);
+
+ var Utils = _interopRequireWildcard(_import);
+
+ var _Exception = __webpack_require__(8);
+
+ var _Exception2 = _interopRequireWildcard(_Exception);
+
+ var _COMPILER_REVISION$REVISION_CHANGES$createFrame = __webpack_require__(6);
+
+ function checkRevision(compilerInfo) {
+ var compilerRevision = compilerInfo && compilerInfo[0] || 1,
+ currentRevision = _COMPILER_REVISION$REVISION_CHANGES$createFrame.COMPILER_REVISION;
+
+ if (compilerRevision !== currentRevision) {
+ if (compilerRevision < currentRevision) {
+ var runtimeVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[currentRevision],
+ compilerVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[compilerRevision];
+ throw new _Exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').');
+ } else {
+ // Use the embedded version info since the runtime doesn't know about this revision yet
+ throw new _Exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').');
+ }
+ }
+ }
+
+ function template(templateSpec, env) {
+ /* istanbul ignore next */
+ if (!env) {
+ throw new _Exception2['default']('No environment passed to template');
+ }
+ if (!templateSpec || !templateSpec.main) {
+ throw new _Exception2['default']('Unknown template object: ' + typeof templateSpec);
+ }
+
+ // Note: Using env.VM references rather than local var references throughout this section to allow
+ // for external users to override these as psuedo-supported APIs.
+ env.VM.checkRevision(templateSpec.compiler);
+
+ function invokePartialWrapper(partial, context, options) {
+ if (options.hash) {
+ context = Utils.extend({}, context, options.hash);
+ }
+
+ partial = env.VM.resolvePartial.call(this, partial, context, options);
+ var result = env.VM.invokePartial.call(this, partial, context, options);
+
+ if (result == null && env.compile) {
+ options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
+ result = options.partials[options.name](context, options);
+ }
+ if (result != null) {
+ if (options.indent) {
+ var lines = result.split('\n');
+ for (var i = 0, l = lines.length; i < l; i++) {
+ if (!lines[i] && i + 1 === l) {
+ break;
+ }
+
+ lines[i] = options.indent + lines[i];
+ }
+ result = lines.join('\n');
+ }
+ return result;
+ } else {
+ throw new _Exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode');
+ }
+ }
+
+ // Just add water
+ var container = {
+ strict: function strict(obj, name) {
+ if (!(name in obj)) {
+ throw new _Exception2['default']('"' + name + '" not defined in ' + obj);
+ }
+ return obj[name];
+ },
+ lookup: function lookup(depths, name) {
+ var len = depths.length;
+ for (var i = 0; i < len; i++) {
+ if (depths[i] && depths[i][name] != null) {
+ return depths[i][name];
+ }
+ }
+ },
+ lambda: function lambda(current, context) {
+ return typeof current === 'function' ? current.call(context) : current;
+ },
+
+ escapeExpression: Utils.escapeExpression,
+ invokePartial: invokePartialWrapper,
+
+ fn: function fn(i) {
+ return templateSpec[i];
+ },
+
+ programs: [],
+ program: function program(i, data, declaredBlockParams, blockParams, depths) {
+ var programWrapper = this.programs[i],
+ fn = this.fn(i);
+ if (data || depths || blockParams || declaredBlockParams) {
+ programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths);
+ } else if (!programWrapper) {
+ programWrapper = this.programs[i] = wrapProgram(this, i, fn);
+ }
+ return programWrapper;
+ },
+
+ data: function data(value, depth) {
+ while (value && depth--) {
+ value = value._parent;
+ }
+ return value;
+ },
+ merge: function merge(param, common) {
+ var obj = param || common;
+
+ if (param && common && param !== common) {
+ obj = Utils.extend({}, common, param);
+ }
+
+ return obj;
+ },
+
+ noop: env.VM.noop,
+ compilerInfo: templateSpec.compiler
+ };
+
+ function ret(context) {
+ var options = arguments[1] === undefined ? {} : arguments[1];
+
+ var data = options.data;
+
+ ret._setup(options);
+ if (!options.partial && templateSpec.useData) {
+ data = initData(context, data);
+ }
+ var depths = undefined,
+ blockParams = templateSpec.useBlockParams ? [] : undefined;
+ if (templateSpec.useDepths) {
+ depths = options.depths ? [context].concat(options.depths) : [context];
+ }
+
+ return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
+ }
+ ret.isTop = true;
+
+ ret._setup = function (options) {
+ if (!options.partial) {
+ container.helpers = container.merge(options.helpers, env.helpers);
+
+ if (templateSpec.usePartial) {
+ container.partials = container.merge(options.partials, env.partials);
+ }
+ } else {
+ container.helpers = options.helpers;
+ container.partials = options.partials;
+ }
+ };
+
+ ret._child = function (i, data, blockParams, depths) {
+ if (templateSpec.useBlockParams && !blockParams) {
+ throw new _Exception2['default']('must pass block params');
+ }
+ if (templateSpec.useDepths && !depths) {
+ throw new _Exception2['default']('must pass parent depths');
+ }
+
+ return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths);
+ };
+ return ret;
+ }
+
+ function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
+ function prog(context) {
+ var options = arguments[1] === undefined ? {} : arguments[1];
+
+ return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths));
+ }
+ prog.program = i;
+ prog.depth = depths ? depths.length : 0;
+ prog.blockParams = declaredBlockParams || 0;
+ return prog;
+ }
+
+ function resolvePartial(partial, context, options) {
+ if (!partial) {
+ partial = options.partials[options.name];
+ } else if (!partial.call && !options.name) {
+ // This is a dynamic partial that returned a string
+ options.name = partial;
+ partial = options.partials[partial];
+ }
+ return partial;
+ }
+
+ function invokePartial(partial, context, options) {
+ options.partial = true;
+
+ if (partial === undefined) {
+ throw new _Exception2['default']('The partial ' + options.name + ' could not be found');
+ } else if (partial instanceof Function) {
+ return partial(context, options);
+ }
+ }
+
+ function noop() {
+ return '';
+ }
+
+ function initData(context, data) {
+ if (!data || !('root' in data)) {
+ data = data ? _COMPILER_REVISION$REVISION_CHANGES$createFrame.createFrame(data) : {};
+ data.root = context;
+ }
+ return data;
+ }
+
+/***/ },
+/* 10 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* WEBPACK VAR INJECTION */(function(global) {'use strict';
+
+ exports.__esModule = true;
+ /*global window */
+
+ exports['default'] = function (Handlebars) {
+ /* istanbul ignore next */
+ var root = typeof global !== 'undefined' ? global : window,
+ $Handlebars = root.Handlebars;
+ /* istanbul ignore next */
+ Handlebars.noConflict = function () {
+ if (root.Handlebars === Handlebars) {
+ root.Handlebars = $Handlebars;
+ }
+ };
+ };
+
+ module.exports = exports['default'];
+ /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
+
+/***/ }
+]);
\ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..c237fc2
--- /dev/null
+++ b/index.html
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..7db7f66
--- /dev/null
+++ b/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "common-chunks-hbs",
+ "version": "1.0.0",
+ "description": "get this to work",
+ "main": "index.js",
+ "scripts": {
+ "test": "webpack"
+ },
+ "repository": {
+ "type": "git",
+ "url": ""
+ },
+ "author": "",
+ "license": "MIT",
+ "bugs": {
+ "url": ""
+ },
+ "homepage": "",
+ "devDependencies": {
+ "handlebars": "^3.0.3",
+ "handlebars-loader": "^1.0.2",
+ "webpack": "^1.9.5"
+ }
+}
diff --git a/src/a.js b/src/a.js
new file mode 100644
index 0000000..7f770c5
--- /dev/null
+++ b/src/a.js
@@ -0,0 +1 @@
+console.log('I don\'t do anything!!');
diff --git a/src/b.js b/src/b.js
new file mode 100644
index 0000000..3fc3c17
--- /dev/null
+++ b/src/b.js
@@ -0,0 +1,3 @@
+var bTemp = require('./templates/b.hbs');
+
+document.querySelector('.b').innerHTML = bTemp({file: 'B'});
diff --git a/src/index.js b/src/index.js
new file mode 100644
index 0000000..482e5b3
--- /dev/null
+++ b/src/index.js
@@ -0,0 +1,3 @@
+var mainTemp = require('./templates/main.hbs');
+
+document.querySelector('.main').innerHTML = mainTemp({file: 'MAIN'});
diff --git a/src/templates/b.hbs b/src/templates/b.hbs
new file mode 100644
index 0000000..c5c0d54
--- /dev/null
+++ b/src/templates/b.hbs
@@ -0,0 +1,2 @@
+I come from {{file}}.hbs
+
diff --git a/src/templates/main.hbs b/src/templates/main.hbs
new file mode 100644
index 0000000..843bab2
--- /dev/null
+++ b/src/templates/main.hbs
@@ -0,0 +1 @@
+I come from the main bundle {{file}}.hbs
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000..7caa18d
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,30 @@
+var webpack = require('webpack');
+var CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
+var path = require('path');
+
+module.exports = {
+ entry: {
+ 'bundle-with-hbs': './src/index.js',
+ 'no-hbs': './src/a.js',
+ 'with-hbs': './src/b.js'
+ },
+
+ output: {
+ filename: '[name].js',
+ path: path.resolve('./dist')
+ },
+
+ module: {
+ loaders: [
+ { test: /\.hbs$/, loader: 'handlebars-loader' }
+ ]
+ },
+
+ plugins: [
+ new CommonsChunkPlugin({
+ name: 'commons',
+ filename: 'commons.js',
+ minChunks: 0
+ })
+ ]
+};