Skip to content

arne-strout-icrossing/grunt-compile-handlebars

 
 

Repository files navigation

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.

About

grunt plugin to compile static html from a handlebars plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%