0.1.7 • Published 8 years ago

grunt-caveman v0.1.7

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

grunt-caveman

Compile Caveman templates on the server-side using Grunt. Optionally render templates on the server-side as well.

Installation

npm install grunt-caveman

Usage

Add the grunt-caveman task to your Grunt config:

grunt.loadNpmTasks('grunt-caveman');

Server-side compiling, client-side rendering

caveman: {
  compile: {
    src: ['path/to/templates/*.html'],
    dest: 'public/templates.js'
  }
}

Rendering pre-compiled templates on the client-side:

var myTemplateData = { foo: [1, 2, 3], bar: true };
var html = Caveman.render('myTemplateName', myTemplateData);
document.getElementById('foo').innerHTML = html;

Server-side compiling and rendering

caveman: {
  compile: {
    src: ['path/to/templates/*.html'],
    data: {
      foo: [1, 2, 3],
      bar: true
    },
    render: {
      'indexPage': 'public/index.html',
      'aboutPage': 'public/about/index.html',
      'contactPage': 'public/contact/index.html'
    }
  }
}

License

MIT. Copyright © 2016 Andrew Childs

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

9 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago