gulp-file
Create vinyl files from a string or buffer and insert into the Gulp pipeline.
Last updated 3 years ago by ninjabryan .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gulp-file 
SYNC missed versions from official npm registry.

gulp-file

Build Status NPM version

Create vinyl files from a string or buffer and insert into the Gulp pipeline.

Installation

npm install gulp-file

API

plugin(name, source, options)

Creates a vinyl file with the given name from source string or buffer and returns a transform stream for use in your gulp pipeline.

plugin(sourceArray, options)

Creates vinyl files for each entry in the array. Each entry is an object with a name and source property. A vinyl file is created with the given name and source and inserted into the returned transform stream.

Example

Primus outputs the client library as a string. Using gulp-file we can create a vinyl file from the string and insert it into the gulp pipeline:

var gulp = require('gulp')
  , file = require('gulp-file');

gulp.task('js', function() {
  var str = primus.library();

  return gulp.src('scripts/**.js')
    .pipe(file('primus.js', str))
    .pipe(gulp.dest('dist'));
});

Use it at the beginning of your pipeline by setting src: true:

var gulp = require('gulp')
  , file = require('gulp-file');

gulp.task('js', function() {
  var str = primus.library();

  return file('primus.js', str, { src: true })
    .pipe(gulp.dest('dist'));
});

Options

src

Calls stream.end() to be used at the beginning of your pipeline in place of gulp.src(). Default: false.

BSD Licensed

Current Tags

  • 0.4.0                                ...           latest (3 years ago)

4 Versions

  • 0.4.0                                ...           3 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.0                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Downloads
Today 5
This Week 37
This Month 74
Last Day 6
Last Week 54
Last Month 203
Dependencies (2)
Dev Dependencies (3)
Dependents (117)

Copyright 2014 - 2016 © taobao.org |