handlebars-hot-loader

0.0.1 • Public • Published

Handlebars-hot-loader

Hot reload for Handlebars templates within Backbone or Marionette.

Webpack has Hot Module Replacement feature. It means that you can update your modules without full page reload. Now you can do it with Handlebars templates as well!

Getting started

This thing intended to use in Marionette.js project. Also you need to have configured Webpack build for your project. If you still haven't done yet, read the Webpack docs.

We work as separate loader on top your handlebars-loader, so you still need to use handlebars-loader.

See example directory to see how it works.

Installation

Once you have working Webpack build with hot reload, do the following:

  1. npm install handlebars-hot-loader
  2. npm install regions-extras – this step is nessesary, because we need to instrument our marionette packages
  3. Add the loader into your Webpack configuration
module: {
  loaders: [
    {
      test: /\.hbs/,
      loader: 'handlebars-hotloader!handlebars'
    }
  ]
},
  1. Instrument Marionette Views to work with hotload. Add the following in your application code.
require('regions-extras').register({
    Handlebars: Handlebars,
    Marionette: Marionette
});

Package Sidebar

Install

npm i handlebars-hot-loader

Weekly Downloads

10

Version

0.0.1

License

MIT

Last publish

Collaborators

  • just-boris