Skip to content

Iterates each values and pass to sub tasks. A cascading configurable gulp recipe for gulp-chef.

License

Notifications You must be signed in to change notification settings

gulp-cookery/gulp-ccr-each

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-ccr-each

Iterates each values and pass to sub tasks. A cascading configurable gulp recipe for gulp-chef.

Install

$ npm install --save-dev gulp-chef gulp-ccr-each

Recipe

Stream Array (from gulp-cheatsheet p.2)

Ingredients

Type

Stream Processor

API

config.values

An array of values to iterate. Injecting each value to sub tasks via their "config" context. Configuration of sub task can interpolate the value using template of "{{var}}" syntax. Since the value being passed to sub task via the "config" context, value must be of type "object".

Usage

var gulp = require('gulp');
var chef = require('gulp-chef');
var consolidate = require('gulp-consolidate').bind(null, 'nunjucks');

var meals = chef({
    'stream-array': {
        src: 'template/',
        dest: 'html/',
        each: {
            values: [{
                name: 'apple',
                title: 'Apple Cake',
                price: '25'
            }, {
                name: 'orange',
                title: 'Orange Cookie',
                price: '18'
            }],
            pipe: {
                '.consolidate': {
                    plugin: consolidate,
                    src: 'a.ejs',
                    options: {
                        title: '{{title}}',
                        price: '{{price}}'
                    }
                },
                '.rename': {
                    plugin: 'gulp-rename',
                    options: {
                        basename: '{{name}}',
                        extname: '.html'
                    },
                    spit: true
                }
            }
        }
    }
});

gulp.registry(meals);

License

MIT

Author

Amobiz

About

Iterates each values and pass to sub tasks. A cascading configurable gulp recipe for gulp-chef.

Resources

License

Stars

Watchers

Forks

Packages

No packages published