Neocon Propaganda Machine

gulp-file-additional

0.0.1 • Public • Published

gulp-file-additional

A gulp helper, add additional data to file and list all files in the gulp pipeline.

Install

Install with npm

npm install --save-dev gulp-file-additional

Example

var fileAdditional = require('gulp-file-additional');
var twigFile = ['src/pages/**/*.html.twig'];
 
gulp.task('default', function() {
  gulp.watch(twigFile, function() {
    gulp.src(twigFile).pipe(fileAdditional({
      additional: {
        data: {
          key: 'data',
          value: (filepath) => {
            return 'test';
          }
 
          // value: 'asdfa' // support function or normal value
        }
      }
    }))
  })
})

type gulp in terminal, change twigFile, then output:

[gulp] Using file ./src/pages/normal.html.twig
[gulp] Additional data {"key":"data","value":"test"}

Options

defaults

{
  logfile: {
    on: true,
    prefix: 'Using file',
    color: 'magenta',
    path: 'cwd'
  },
  additional: {
    on: true,
    prefix: 'Additional data',
    color: 'magenta',
    data: {},
  }
}

logfile

on

  • type: boole
  • default: true
  • values: true, false

prefix

  • type: string
  • default: Using file

color

  • type: string
  • default: magenta
  • values: black, blue, cyan, gray, green, magenta, red, white, yellow

path

  • type: string
  • default: cwd
  • values: cwd, path, relative

additional

on

the same as logfile

prefix

the same as logfile

color

the same as logfile

data

  • type: array or object
  • default: {}
{
  key: 'data', // force convert to string
  value: (filepath) => {
    return 'test';
  }
}

or

[{
  key: 'foo',
  value: (filepath) => { // function
    return 'test';
  }
}, {
  key: 'bar',
  value: 'test' // string
}, {
  key: 'foobar',
  value: 110 // number
}]

install

npm i gulp-file-additional

Downloadsweekly downloads

0

version

0.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability