JSPM

gulp-ccr-each

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q27558F
  • License MIT

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

Package Exports

  • gulp-ccr-each

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-ccr-each) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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);