gulp-teleport
Teleport for stream chunks.
Last updated 2 years ago by dangreen .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gulp-teleport 
SYNC missed versions from official npm registry.

gulp-teleport

NPM version Node version Dependency status

Teleport for stream chunks.

Install

npm i -D gulp-teleport
# or
yarn add -D gulp-teleport

About

By using this plugin you can teleport files between streams.

API

Object teleport

gulp-teleport

away(String pathMask = false)

Teleport away files matched by path.

clone(String groupName, String pathMask = false)

Clone files matched by path from current stream to group in storage.

to(String groupName, String pathMask = false)

Teleport files matched by path from current stream to group in storage.

from(String|Array<String> groupMask, String pathMask = false)

Teleport files matched by path to current stream from group in storage.

stream(String|Array<String> groupMask, String pathMask = false)

Get stream of files from store by group name.

waitStream(String|Array<String> groupMask, String pathMask = false, Number timeout = 1min, Number checkInterval = 500)

Wait and get stream of files from store by group name.

wait(String|Array<String> groupMask, String pathMask = false, Number timeout = 1min, Number checkInterval = 500)

Wait group of files.

get(String|Array<String> groupMask, String pathMask = false)

Get files from store by group name.

set(String group, Array<Vinyl> files)

Set files to store by group name.

Example

const gulp   = require('gulp'),
    favicons = require('gulp-favicons'),
    htmlmin  = require('gulp-htmlmin'),
    teleport = require('gulp-teleport');

gulp.task('favicon', () => 
    gulp.src('src/favicon.svg')
        .pipe(favicons({
            ...
            path:     'favicons/',
            html:     'favicons.html',
            pipeHTML: true
        }))
        .pipe(teleport.to('favicons', '**/*.html'))
        .pipe(gulp.dest('dist/favicons'))
);

gulp.task('html', gulp.series('favicon', () =>
    gulp.src('src/*.html')
        .pipe(teleport.wait('favicons'))
        .pipe(replace(
            '<link rel="shortcut icon" href="favicon.svg">',
            () => teleport.get('favicons').map(_ => _.contents.toString('utf8')).join('')
        ))
        .pipe(htmlmin({...}))
        .pipe(gulp.dest('dist'))
));

class TeleportFs

gulp-teleport/lib/fs

constructor(void handler(ReadableStream stream(String pathMask), String destinationDir), Object fs = { ...fs, mkdirp, join: path.join })

Fs proxy contructor, compatible with Node’s own fs module interface.

Example

const webpackCompiler = webpack({...});

webpackCompiler.outputFileSystem = new TeleportFs((stream, dest) => {

    stream('**/rev-manifest.json')
        .pipe(teleport.to('script-rev-manifest'));

    stream('**/webpack-manifest.json')
        .pipe(teleport.clone('webpack-manifest'))
        .pipe(gulp.dest(dest));
});

NPM

Current Tags

  • 2.3.0                                ...           latest (2 years ago)

6 Versions

  • 2.3.0                                ...           2 years ago
  • 2.2.1                                ...           2 years ago
  • 2.2.0                                ...           2 years ago
  • 2.1.0                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |