Skip to content

Instantly share code, notes, and snippets.

@jonschlinkert
Created December 8, 2012 23:41
Show Gist options
  • Save jonschlinkert/4242550 to your computer and use it in GitHub Desktop.
Save jonschlinkert/4242550 to your computer and use it in GitHub Desktop.
This is an example grunt plugin for compiling templates to jst or html, using consolidate.js as a "template engine normalizer"
{
"en-us": {
"alert": {
"default": {
"modifier": "",
"heading": "Default",
"strong": "Default Alert!",
"message": "Best check yo self, you're not looking too good."
},
"warning": {
"modifier": " alert-warning",
"heading": "Warning",
"strong": "Warning!",
"message": "Best check yo self, you're not looking too good."
},
"error": {
"modifier": " alert-error",
"heading": "Error",
"strong": "Oh Snap!",
"message": "Change a few things up and try submitting again."
},
"success": {
"modifier": " alert-success",
"heading": "Success",
"strong": "Well Done!",
"message": "You successfully read this important alert message."
},
"info": {
"modifier": " alert-info",
"heading": "Information",
"strong": "Heads Up!",
"message": "This alert needs your attention, but it's not super important."
}
}
}
}
/*global module:false*/
module.exports = function(grunt) {
'use strict';
// Project configuration
grunt.initConfig({
templates: {
arbitraryTargetOne: {
options: {
engine: "handlebars", // see assemble docs for the options available for each engine
language: "en-us", // if empty, then the base object in each json file will be the partial or component
flatten: false, // if false, the src files will retain their folder structure in the dest
production: false,
layout: 'docs/templates/layout.mustache',
partials: ['src/templates/partials/*.mustache', '../docs/templates/partials/*.mustache'],
data: ['src/templates/data.json', 'src/templates/partials/*.json']
},
files: {
"docs/": ['docs/templates/pages/*.mustache','app/templates/pages/*.mustache']
}
}
}
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-assemble');
// Register default task to be run.
grunt.registerTask('default', ['templates']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment