@hugsmidjan/gulp-rollup
script bundling gulp task using rollup
Last updated 3 days ago by hugsmidjan .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @hugsmidjan/gulp-rollup 
SYNC missed versions from official npm registry.

@hugsmidjan/gulp-rollup

npm install --save-dev @hugsmidjan/gulp-rollup

Usage

const [scripts, scriptsWatch] = require('@hugsmidjan/gulp-rollup')(opts);

API / Advanced usage

const rollupTaskFactory = require('@hugsmidjan/gulp-rollup');

const options = {
  // These are the defaults:
  name: 'scripts', // the display name of the generated tasks
  src: 'src/',
  dist: 'pub/',
  glob: '*.{js,jsx,ts,tsx}', // Glob|Array<Glob> for entry points. Use '!' prefix to ignore
  // entryPoints: null, // Advanced: rollup.input map - overrides the `glob` option
  NODE_ENV: process.env.NODE_ENV,
  // plugins: [], // custom list of plugins
  // replaceOpts: {}, // custom options for rollup-plugin-replace
  // terserOpts: {}, // custom options for rollup-plugin-terser
  // typescriptOpts: {}, // custom options for rollup-plugin-typescript2
  minify: true,
  sourcemaps: true,
  format: 'iife', // Rollup output format
  codeSplit: true, // (kicks in when format isn't 'iife')
  // inputOpts: {},
  // outputOpts: {},
  // watchOpts: {},
};

// If the `options` object isn't flexible enough...
const customConfigger = (rollupConfig) => {
  return {
    ...rollupConfig,
    // Replace or add properties or mutate rollupConfig directly.
  };
};

// Create the gulp tasks based on the above options.
const scriptTasks = rollupTaskFactory(options, customConfigger);

// scriptTasks is a two item array...
const [scripts, scriptsWatch] = scriptTasks;
// ...but it also exposes the tasks as named properties.
const { bundle, watch } = scriptTasks;

For convenience, the "task factory" function also exposes the rollup plugins it uses, as well as its file-globbing module.

console.log(rollupTaskFactory.plugins);

TypeScript support.

This task automatically bundles TypeScript files, but it's BYOTS (Bring Your Own TypeScript).

The Typescript plugin is invoked if typescriptOpts are present (even if they're empty), or a tsconfig.json file is detected in/or above the current folder.

It respects ./tsconfig.json, but some compiler options are forced.

Additionally, compilerOptions.jsx is hard-defaulted to 'react', but it can be overridden via typescriptOpts.tsconfigOverride.compilerOptions.jsx.

Current Tags

  • 0.3.18                                ...           latest (3 days ago)

24 Versions

  • 0.3.18                                ...           3 days ago
  • 0.4.0-canary.1                                ...           5 days ago
  • 0.4.0-canary                                ...           6 days ago
  • 0.3.17                                ...           10 days ago
  • 0.3.16                                ...           17 days ago
  • 0.3.15                                ...           17 days ago
  • 0.3.14                                ...           a month ago
  • 0.3.12                                ...           a month ago
  • 0.3.11                                ...           a month ago
  • 0.3.10                                ...           2 months ago
  • 0.3.9                                ...           2 months ago
  • 0.3.8                                ...           2 months ago
  • 0.3.7                                ...           2 months ago
  • 0.3.6                                ...           2 months ago
  • 0.3.5                                ...           2 months ago
  • 0.3.4                                ...           3 months ago
  • 0.3.3                                ...           4 months ago
  • 0.3.2 [deprecated]           ...           4 months ago
  • 0.3.1                                ...           5 months ago
  • 0.3.0                                ...           6 months ago
  • 0.2.2                                ...           6 months ago
  • 0.2.1                                ...           6 months ago
  • 0.2.0 [deprecated]           ...           6 months ago
  • 0.1.0                                ...           6 months ago
Maintainers (1)
Downloads
Today 0
This Week 63
This Month 84
Last Day 24
Last Week 12
Last Month 80
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |