@hidoo/gulp-task-build-js-browserify

    0.19.0 • Public • Published

    @hidoo/gulp-task-build-js-browserify

    Task that build javascript by browserify for gulp.

    Installation

    $ npm install --save-dev gulp@next @babel/{core,polyfill,preset-env} @hidoo/gulp-task-build-js-browserify

    Usage

    import {task} from 'gulp';
    import buildJs from '@hidoo/gulp-task-build-js-browserify';
    
    task('js', buildJs({
      src: '/path/to/js/main.js',
      dest: '/path/to/dest'
    }));

    API

    buildJs

    return javascript build task by browserify

    Parameters

    • options Object options (optional, default {})

      • options.name String task name (use as displayName) (optional, default 'build:js')
      • options.src String source path
      • options.dest String destination path
      • options.filename String destination filename (optional, default 'main.js')
      • options.suffix String suffix when compressed (optional, default '.min')
      • options.targets Array<String>? target browsers. see: default target browsers
      • options.browsers Array<String>? alias of options.targets.
      • options.useBuiltIns (String | Boolean) use polyfill or not. see: useBuiltIns in @babel/preset-env (optional, default 'usage')
      • options.corejs (Number | String | Object) specify core-js version (Recommend setting with options.useBuiltIns: 'entry') see: corejs in @babel/preset-env (optional, default 3)
      • options.babelrc String babelrc path (optional, default path.resolve(process.cwd(),'.babelrc.js'))
      • options.compress Boolean compress file or not (optional, default false)
      • options.verbose Boolean out log or not (optional, default false)

    Examples

    import {task} from 'gulp';
    import buildJs from '@hidoo/gulp-task-build-js-browserify';
    
    task('js', buildJs({
      name: 'js:main',
      src: '/path/to/js/main.js',
      dest: '/path/to/dest',
      filename: 'main.js',
      suffix: '.hoge',
      targets: ['> 0.1% in JP'],
      useBuiltIns: false,
      corejs: 2,
      babelrc: '/path/to/.babelrc.js',
      compress: true,
      verbose: true
    }));

    Returns Function<Stream>

    Test

    $ yarn test

    License

    MIT

    Keywords

    Install

    npm i @hidoo/gulp-task-build-js-browserify

    DownloadsWeekly Downloads

    56

    Version

    0.19.0

    License

    MIT

    Unpacked Size

    18.3 kB

    Total Files

    5

    Last publish

    Collaborators

    • hidoo