@hidoo/gulp-task-concat

0.19.0 • Public • Published

@hidoo/gulp-task-concat

Task that concat files for gulp.

Installation

$ npm install --save-dev gulp@next @hidoo/gulp-task-concat

Usage

for JavaScript:

import {task} from 'gulp';
import {concatJs} from '@hidoo/gulp-task-concat';

task('concat:js', concatJs({
  src: [
    '/path/to/js/a.js'
    '/path/to/js/b.js'
    '/path/to/js/c.js'
  ],
  dest: '/path/to/dest'
}));

for CSS:

import {task} from 'gulp';
import {concatCss} from '@hidoo/gulp-task-concat';

task('concat:css', concatCss({
  src: [
    '/path/to/css/a.css'
    '/path/to/css/b.css'
    '/path/to/css/c.css'
  ],
  dest: '/path/to/dest'
}));

API

concatJs

return javascript concat task

Parameters

  • options Object options (optional, default {})

    • options.name String task name (use as displayName) (optional, default 'build:asset')
    • options.src Array<String> source path
    • options.dest String destination path
    • options.filename String destination filename (optional, default 'bundle.js')
    • options.suffix String suffix when compressed (optional, default '.min')
    • options.banner String license comments (optional, default '')
    • options.compress Boolean compress file or not (optional, default false)

Examples

import {task} from 'gulp';
import {concatJs} from '@hidoo/gulp-task-concat';

task('concat:js', concatJs({
  name: 'js:deps',
  src: [
    '/path/to/js/a.js',
    '/path/to/js/b.js',
    '/path/to/js/c.js'
  ],
  dest: '/path/to/dest',
  filename: 'deps.js',
  suffix: '.hoge',
  banner: '/*! copyright <%= pkg.author %> * /\n',
  compress: true
}));

Returns Function<Stream>

concatCss

return css concat task

Parameters

  • options Object options (optional, default {})

    • options.name String task name (use as displayName) (optional, default 'build:asset')
    • options.src Array<String> source path
    • options.dest String destination path
    • options.filename String destination filename (optional, default 'bundle.css')
    • options.suffix String suffix when compressed (optional, default '.min')
    • options.banner String license comments (optional, default '')
    • options.compress Boolean compress file or not (optional, default false)

Examples

import {task} from 'gulp';
import {concatCss} from '@hidoo/gulp-task-concat';

task('concat:css', concatCss({
  name: 'css:deps',
  src: [
    '/path/to/css/a.css',
    '/path/to/css/b.css',
    '/path/to/css/c.css'
  ],
  dest: '/path/to/dest',
  filename: 'deps.css',
  suffix: '.hoge',
  banner: '/*! copyright <%= pkg.author %> * /\n',
  compress: true
}));

Returns Function<Stream>

Test

$ yarn test

License

MIT

Dependencies (13)

Dev Dependencies (12)

Package Sidebar

Install

npm i @hidoo/gulp-task-concat

Weekly Downloads

73

Version

0.19.0

License

MIT

Unpacked Size

20.4 kB

Total Files

5

Last publish

Collaborators

  • hidoo