JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5671
  • Score
    100M100P100Q129500F

Compile handlebar templates, outputting static HTML

Package Exports

  • grunt-compile-handlebars

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (grunt-compile-handlebars) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

grunt-compile-handlebars

Compiles handlebar templates, outputs static HTML

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-compile-handlebars

Then add this line to your project's grunt.js gruntfile:

grunt.loadNpmTasks('grunt-compile-handlebars');

Documentation

Who

patrick kettner - a web developer who consistently worked with large static data sets.

What

grunt-compile-handlebars takes in a handlebars tempalte (and optionally static pre and post html), runs a dataset over it, and outputs static html.

Where

inside of a grunt task. I assume you know what gruntjs is, but if not - gruntjs.com

When

this questions doesn't even make sense

How

Inside your grunt.js file:

'compile-handlebars': {
    development: {
        preHTML: 'src/pre.html',
        postHTML: 'src/post.html',
        template: 'index.handlebars',
        output: 'dist/index.html',
        templateData: {
            foo: 'bar'
        }
    },
    staging: {
        template: 'index.handlebars',
        output: 'dist/index.html',
        templateData: '<json:src/staging.json>'
    }
}

Why

I had to work with several hundred repeated data structures that never changed. Keeping them all in html was silly, but pushing out a template engine for the end user to compile the same information multiple times was even sillier. This allows you to have your templated cake and eat it too.

Release History

  • 0.0.2 - Inez changed to grunt's native json parser (thanks to @sebslomski). Updated Readme
  • 0.0.1 - Dudley Initial commit

License

Copyright (c) 2012 Patrick Kettner Licensed under the MIT license.