GitXplorerGitXplorer
h

grunt-mustache-html

public
9 stars
7 forks
2 issues

Commits

List of commits on branch master.
Unverified
560ba1f22bc9190d6e7853f07cff51e8f45c3e00

Support for functions in JSON

iimapi committed 10 years ago
Unverified
f8a036eb1811f1bedaa3120d186a38d6df63634f

Update README

hhaio committed 10 years ago
Unverified
491751b0d514d7a7619ed74bf2cfe0cbb80bfa29

Fix document

hhaio committed 11 years ago
Unverified
b9f30f13716c6b71e036c998f488858d531378da

0.1.6

hhaio committed 11 years ago
Unverified
49a2c25cbee7b8a2e02468da4c618f6e76ce2b37

Merge pull request #2 from Ptico/master

hhaio committed 11 years ago
Unverified
2382df8986b9571a99d757d34f05a7ef78597fcd

Fix visibility of globals in layout

PPtico committed 11 years ago

README

The README file for this repository.

grunt-mustache-html

Compile mustache or hbs templates.

Getting Started

This plugin requires Grunt ~0.4.2

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-mustache-html --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-mustache-html');

The "mustache_html" task

Overview

Generate static HTML file from mustache|hbs JST for static HTML docs.

grunt.initConfig({
  mustache_html: {
    development: {
      options: {
        src: 'src',
        dist: 'dist',
        type: 'mustache' // mustache Or hbs
      },
      globals: {
        analytics_id: 'UA-123456-1'
      }
    }
  }
});

Now the subtask mustache_html:development is available.

options

options.src

Type: String Default value: src

The source directory of your templates, the directory should be structured like:

.
├── layout.mustache
├── pages
   └── index.json
   └── index.mustache
└── partials
    ├── nav.json
    └── nav.mustache
  • layout.mustache must exist, and its name should have prefix layout
  • pages contains the page templates that are eventually created, .json contains the page specify data which can be also rendered in layout page. Use {{>content}} in layout.mustache to paste the page's content in.
  • partials contains the partial templates that might be used in the page templates, .json contains the json formatted data, its name must be the save as the partial's.

options.dist

Type: String Default value: dist

The destination directory of the created HTML files.

options.type

Type: String Default value: mustache

The type of JST, can be mustache or hbs.

globals

Type: Object Default value: {}

Contains global data. May be used to define environment-specific variables

Test

Run grunt test.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)