GitXplorerGitXplorer
h

grunt-mustache-html

public
9 stars
7 forks
2 issues

Commits

List of commits on branch master.
Unverified
3b2d79cae59502f3ee52491b5522c9d80c6645f5

0.1.9

hhaio committed 10 years ago
Unverified
1dfc9c4907924b381b87246543acfe9db5edfd9a

Merge pull request #7 from rocco/patch-1

hhaio committed 10 years ago
Unverified
19768456cf70509cc17328e59426de0d9dc91043

added hint about {{>content}} in layout.mustache, fixed some typos

rrocco committed 10 years ago
Unverified
c339c55b40f31cedf072ffde2b1687da7ebd9da0

0.1.8

hhaio committed 10 years ago
Unverified
03a092a813b1e5c9de02a30787d74dec6fa6a6df

Merge pull request #5 from imapi/master

hhaio committed 10 years ago
Unverified
40dacbfc03c488b35c501b08a49cff077cf0181e

try/catch addition

iimapi committed 10 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)