Skip to content

AdamHerrmann/rollup-vinyl-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rollup-vinyl-stream

Create a vinyl stream from a Rollup bundle.

Installation

yarn add -D rollup-vinyl-stream

Basic Usage

const gulp         = require('gulp');
const rollupStream = require('rollup-vinyl-stream');

gulp.task('rollup', () =>
  rollupStream({
    entry:  './src/index.js',
    dest:   'index.js',
    format: 'umd',
  })
  .pipe(gulp.dest('./dist'))
);

Multiple Targets

const gulp         = require('gulp');
const rollupStream = require('rollup-vinyl-stream');

gulp.task('rollup', () =>
  rollupStream({
    entry:  './src/index.js',
    targets: [
      {
        dest:   'index.umd.js',
        format: 'umd',
      },
      {
        dest:   'index.cjs.js',
        format: 'cjs',
      },
    ],
  })
  .pipe(gulp.dest('./dist'))
);

Load Config File

const gulp         = require('gulp');
const rollupStream = require('rollup-vinyl-stream');

gulp.task('rollup', () =>
  rollupStream({config: './rollup.config.js'})
  .pipe(gulp.dest('./dist'))
);

Use Cache

const gulp         = require('gulp');
const rollupStream = require('rollup-vinyl-stream');
let   cache;

gulp.task('rollup', () =>
  rollupStream({
    config: './rollup.config.js',
    cache,
  })
  .on('bundle', (bundle) => cache = bundle)
  .pipe(gulp.dest('./dist'))
);

Cache Options

const gulp         = require('gulp');
const rollupStream = require('rollup-vinyl-stream');
let   options      = {config: './rollup.config.js'};

gulp.task('rollup', () =>
  rollupStream(options)
  .on('config', (config) => options = config)
  .on('bundle', (bundle) => options.cache = bundle)
  .pipe(gulp.dest('./dist'))
);

About

Create a vinyl stream from a Rollup bundle.

Resources

License

Stars

Watchers

Forks

Packages

No packages published