This package has been deprecated

Author message:

this version has been deprecated

maquetus-generator

1.6.0 • Public • Published

Generator

A super simple flat file generator for use with Gulp. It compiles a series of HTML pages using a common layout. These pages can also include HTML partials, external Handlebars helpers, or external data as JSON or YAML.

Installation

npm install maquetus-generator

Usage

var gulp = require('gulp');
var maquetus = require('maquetus-generator');

gulp.task('default', function() {
    gulp.src('./src/pages/**/*.hbs')
    .pipe(maquetus({
        layouts: './src/layouts',
        partials: './src/partials',
        helpers: './src/helpers',
        data: './src/data'
    }))
    .pipe(gulp.dest('./dist'));
});

Options

layouts

Type: String

Path to a folder containing layouts. Layout files can have the extension .html, .hbs, or .handlebars. One layout must be named default.

---
layout: post
---

<!-- Uses layouts/post.html as the template -->

partials

Type: String or Object

Path to a folder containing HTML partials. Partial files can have the extension .html, .hbs, or .handlebars. Each will be registered as a Handlebars partial which can be accessed using the path of the file.

// Single path
maquetus({
    partials: './src/partials' // Use: {{> nameFile }} or {{> dir/nameFile }}
}

// Multiple paths
maquetus({
    partials: {
        components: './src/components', // Use: {{> components/nameFile }} or {{> components/dir/nameFile }}
        partials: './src/partials' // Use: {{> partials/nameFile }} or {{> partials/dir/nameFile }}
    }
}

helpers

Type: String

Path to a folder containing Handlebars helpers. Handlebars helpers are .js files which export a function via module.exports. The name used to register the helper is the same as the name of the file.

For example, a file named markdown.js that exports this function would add a Handlebars helper called {{markdown}}.

var marked = require('marked');

module.exports = function(text) {
    return marked(text);
}

data

Type: String

Path to a folder containing external data, which will be passed in to every page. Data can be formatted as JSON (.json) or YAML (.yml). Within a template, the data is stored within a variable with the same name as the file.

For example, a file named contact.json with key/value pairs such as the following:

{
    "name": "John Doe",
    "email": "john.doe@gmail.com",
    "phone": "555-1212"
}

Could be used to output the value of John Doe within a template using the Handlebars syntax of {{ contact.name }}.

Data can also be inserted into the page itself with a Front Matter template at the top of the file.

Lastly, the reserved body, page variables are added to every page template as it renders.

Package Sidebar

Install

npm i maquetus-generator

Weekly Downloads

2

Version

1.6.0

License

MIT

Unpacked Size

17.8 kB

Total Files

31

Last publish

Collaborators

  • jpuche