@alexistessier/gulp-workflow-common-task
A set of common gulp task I use
Last updated 3 years ago by alexistessier .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @alexistessier/gulp-workflow-common-task 
SYNC missed versions from official npm registry.

@alexistessier/gulp-workflow-common-task

version npm version

Dependencies Status devDependencies Status

Home Page

A set of common gulp task I use

Purpose

Reuse some gulp tasks through projects

Install

npm install @alexistessier/gulp-workflow-common-task

How to use

var path = require('path');

var task = require('@alexistessier/gulp-workflow-common-task');

//Set a task named babel-es6-for-node
//Set a babel task, with the "es6-for-node" preset
task.babel('es6-for-node');

//Set a task named mustache-readme-for-node-package
//Set a mustache task, with the "readme-for-node-package" preset and custom params
task.mustache('readme-for-node-package', {
	'view.myCustomData': 'Hello world'
});

//Then the build and watch tasks can be defined like that
task.build();
task.watch();

task.default('build');

Common tasks list

#####task.babel

gulp.task('babel', function (done) {
	gulp.src(params.src)
		.pipe(plumber())
		.pipe(sourcemaps.init())
		.pipe(babel(params.options))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest(params.dest))

		.on('end', function() {
			done();
		});
});

Available presets

  • es6-for-node (default)

    aram type description or default value
    rc object [path.join(process.cwd(), "sources/**/*.js")]
    ptions object {"presets":["babel-preset-es2015"]}
    est string "build/"

#####task.moduleBuild

params.options.rollup.plugins = _.isArray(params.options.rollup.plugins) ? params.options.rollup.plugins : [];
params.options.rollup.plugins.unshift(commonjs(params.options.commonjs));
params.options.rollup.plugins.unshift(nodeResolve(params.options.nodeResolve));
params.options.rollup.plugins.unshift(rollupFlow(params.options.flow));

gulp.task('moduleBuild', function (done) {
	var stream = rollup(_.assign({}, {
			entry: params.entry,
			sourceMap: true
		}, params.options.rollup))
		.pipe(source(path.basename(params.entry), path.dirname(params.entry)))
		.pipe(buffer())
		.pipe(plumber())
		.pipe(sourcemaps.init({loadMaps: true}))
		.pipe(babel(params.options.babel))

		if(params.uglify === true){
			stream = stream.pipe(uglify(params.options.uglify));
		}
		
		stream.pipe(rename(params.outputName))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest(params.dest))
		.on('end', function() {
			done();
		});
});

Available presets

  • flowtype-rollup-es6-uglify (default)

    aram type description or default value
    ntry object path.join(process.cwd(), "sources/index.js")
    rc object [path.join(process.cwd(), "sources/**/*.js")]
    utputName string "bundle.js"
    glify boolean true
    ptions object {"commonjs":{"include":"node_modules/**","exclude":[],"extensions":[".js"],"namedExports":{}},"rollup":{"format":"umd","moduleId":"gulp-workflow-common-task","moduleName":"GulpWorkflowCommonTask","indent":false},"nodeResolve":{"module":true,"jsnext":true,"main":true,"skip":[],"extensions":[".js",".json"],"preferBuiltins":true,"browser":true},"flow":{"all":false,"pretty":false},"uglify":{},"babel":{"presets":["es2015"]}}
    est string "build/"

#####task.mustache

gulp.task('mustache', function(done) {
	gulp.src(params.src)
		.pipe(plumber())
		.pipe(mustache(params.view))
		.pipe(rename(function (path) {
			path.basename = path.basename.replace(params.destExt, '');
			path.extname = params.destExt;
		}))
		.pipe(gulp.dest(params.dest))
		.on('end', function() {
			done();
		});
});

Available presets

  • readme-for-node-package

    aram type description or default value
    rc object [path.join(process.cwd(), "README.mustache")]
    iew object Some computed values: package,furyiopath,username
    estExt string ".md"
    est string "./"

#####task.documentation

gulp.task('documentation', function(done) {
	gulp.src(params.src, {read: false})
		.pipe(plumber())
		.pipe(gulpDocumentation('html', params.options, params.information))
		.pipe(gulp.dest(params.dest))
		.on('end', done)
});

Available presets

  • html (default)

    aram type description or default value
    rc object [path.join(process.cwd(), "sources/**/*.js")]
    ptions object {"polyglot":false}
    nformation object {"name":"gulp-workflow-common-task","version":"2.10.0"}
    est string "documentation"

Current Tags

  • 2.11.0                                ...           latest (3 years ago)

24 Versions

  • 2.11.0                                ...           3 years ago
  • 2.10.0                                ...           3 years ago
  • 2.9.0                                ...           3 years ago
  • 2.8.0                                ...           3 years ago
  • 2.7.0                                ...           3 years ago
  • 2.6.0                                ...           3 years ago
  • 2.5.1                                ...           3 years ago
  • 2.5.0                                ...           3 years ago
  • 2.4.1                                ...           3 years ago
  • 2.4.0                                ...           3 years ago
  • 2.3.1                                ...           3 years ago
  • 2.3.0                                ...           3 years ago
  • 2.2.1                                ...           3 years ago
  • 2.2.0                                ...           3 years ago
  • 2.1.4                                ...           3 years ago
  • 2.1.3                                ...           3 years ago
  • 2.1.2                                ...           3 years ago
  • 2.1.1                                ...           3 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 127
Dependencies (19)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |