2.2.1 • Published 3 years ago

gulp-mass-production v2.2.1

Weekly downloads
1
License
ISC
Repository
github
Last release
3 years ago

gulp-mass-production

gulp plugin for generating multiple articles.

Install

from npm

npm install -D gulp-mass-production

or

yarn add gulp-mass-production

Usage

You can choose format from json (as postParams) or markdown.

Using Json

gulp.task('html', () => {
    const params = {
        hoge: {
            title: 'hoge title',
            tags: ['a', 'b'],
            body: 'body body body body...'
        },
        moge: {
            title: 'moge title',
            tags: [],
            body: 'body body body body...'
        }
    };

    gulp.src('pug/*.pug')
        .pipe(massProduction({
            postParams: params,
            template: 'pug/post.pug'
        }))
        .pipe(pug())
        .pipe(gulp.dest('htdocs'));
});

Running this task, and generating htdocs/hoge/index.html and htdocs/moge/index.html.

Using Markdown

gulp.task('html', () => {
    gulp.src('pug/*.pug')
        .pipe(massProduction({
            markdown: "posts/*.md"
            template: 'pug/post.pug'
        }))
        .pipe(pug())
        .pipe(gulp.dest('htdocs'));
});

Write markdown article by Frontmatter format.

---
title: hoge title
tags:
  - a
  - b
---
body body body body...

Pug template & Output

- meta = massProduction.meta
 
h1= meta.title
p= meta.body
<h1>hoge title</h1>
<p>body body body body...</p>

Options

VariableTypeDefaultDescription
hrefRuleFunctionfunction (slug, meta) { return slug; };Customize html output format ( By default create the directory unless '.html')
localsObjectnullLocals to compile template with
markdownStringnullMarkdown file that is used on template file
markedOptsObject{ breaks: true }Read here
namespaceString'massProduction'Object name that is used on template file
postParamsObjectnullData that is used on template file
2.2.1

3 years ago

2.2.0

3 years ago

2.1.0

6 years ago

2.0.2

6 years ago

2.0.0

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago