Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
grunt plugin to compile static html from a handlebars plugin
JavaScript HTML

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
tasks
test
.gitignore
.jshintrc
.npmignore
.travis.yml
CONTRIBUTORS.md
Gruntfile.js
LICENSE-MIT
README.md
package.json

README.md

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) 2013 Patrick Kettner Licensed under the MIT license.

Something went wrong with that request. Please try again.