npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-task-builder

v1.0.14

Published

Gulp task builder using a json object.

Downloads

25

Readme

Gulp Task Builder

Node module task builder which can be configured by a JSON Object containing the relevant tasks to build.

Version Build Status Docs License Downloads

DESCRIPTION

Node module task builder which can be configured by a JSON Object containing the relevant tasks to build. Now you dont need to write gulp tasks in javascript just feine object then thats it.

Table of Contents

Getting Started

  1. Setup

. Features

. TODO

Setup

Install

npm install gulp-task-builder -D

Usage

var builder = require('gulp-task-builder')
var tasks = {
  "task1":{src:"path/to/source/files", dest:"path/to/save"}
}
builder.loadTasks(tasks);
builder.runTasks();

Task Options

Examples

Basic Example

with required options

var builder = require('gulp-task-builder')
var tasks = {
  "task1":{src:"./src/*.js", ext:".js", dest:"dest"},
  "task2":{src:"./packages/*.js", ext:".js", dest:"dest/lib"}
}
builder.loadTasks(tasks);
builder.runTasks();

Compress

Compress your files with the compress option. This function is using

{src:"./src/*.js", ext:".js", dest:"dest", compress:true}
{src:"./src/*.html", ext:".html", dest:"dest", compress:{collapseWhitespace: true}}
{src:"./src/*.css", ext:".css", dest:"dest", compress:{compatibility: 'ie8'}}
{src:"./src/*.json", ext:".json", dest:"dest", compress:true}

for more css options Click Here

Concatenate

Concatenate (join) your files with the concat option.

//File name will be task1.js which is the task name
task1:{src:"./src/*.js", ext:".js", dest:"dest", concat:true}

//File name will be jsbundle.js which is the task name
task1:{src:"./src/*.js", ext:".js", dest:"dest", concat:true, name:"jsbundle"}

//JSON
//File name will be jsbundle.json which is the task name
task1:{src:"./src/*.json", ext:".json", dest:"dest", concat:true, name:"jsonbundle"}

Filter

Filter your source files with the filter option.

{src:"./src/*.js", ext:".js", dest:"dest", filter:'!src/vendor'}
{src:"./src/*.js", ext:".js", dest:"dest", filter:['*', '!src/vendor']}
{src:"./src/*.js", ext:".js", dest:"dest", filter:{match:['*', '!src/vendor'], options:{restore:true, passthrough:true, dot:true}}}
{src:"./src/*.js", ext:".js", dest:"dest", filter:function(file){ /*You can access file.cwd, file.base, file.path and file.contents */ }}

restore and passthrough will come very soon.

Rename

Rename your destination file or path. You can provide String|Function|Object.

{src:"./src/*.js", ext:".js", dest:"dest", rename:"main/text/ciao/goodbye.md"}
{src:"./src/*.js", ext:".js", dest:"dest", rename:function (path) { path.dirname += "/ciao"; path.basename += "-goodbye"; path.extname = ".md" }}
{src:"./src/*.js", ext:".js", dest:"dest", rename:{dirname: "main/text/ciao", basename: "aloha", prefix: "bonjour-", suffix: "-hola", extname: ".md"}}

Wrapper

Wrap your files or target files with the given headers and footers Object|Array.

{src:"./src/*.js", ext:".js", dest:"dest", wrapper:{header:"this will be header", footer:"this will be footer"}}
{src:"./src/*.js", ext:".js", dest:"dest", wrapper:[{header:"header1", footer:"footer1"}{header:"headerN", footer:"footerN"}]}

Log contents

You can also log paths contents and other stream options. In case set to true the default value will be contents

{src:"./src/*.js", ext:".js", dest:"dest", log:true}
{src:"./src/*.js", ext:".js", dest:"dest", preLog:true}
{src:"./src/*.js", ext:".js", dest:"dest", preLog:'path'}// Console Paths

Disable save

You can also disable the save option by setting save:false

{src:"./src/*.js", ext:".js", dest:"dest", save:false}

Task options

Each task contains REQUIRED options which can be passed along with OPTIONALS(Flow Control, Plugins, Log Options).

REQUIRED

Required Options

  • src (string) Gulp src parameter. Path of your source files. It can be also regEx. More Details.
  • dest (string) Gulp dest parameter. Path where you want to save your files. More Details.
  • ext (string) extension of file which is defined in src option.

OPTIONALS

Flow Control

  • runBefore (string|Array(string)) Define task dependencies which will run before this task.
  • save (bool) Set true if you want to save your output. Default true.
  • name (string) Recommended. Define unique name of gulp task.
  • order (Array(string)) Define flow of execution. Like ['log','filter','compress','concat','wrapper'].

Plugins

This package is using below pluging

| Task | Plugin | Value Type | Description | | ---- | ------ | ---------- | ----------- | | Filter | gulp-filter | Object String Array Function | To filter your files. if you are sending Object then that object should have two properties match and options. See gulp-filter for more details. | | Concat | gulp-concatgulp-merge-json | StringObject | object contains two properties name and ext. | | Replace | gulp-replace | Objectarray(objects) | Object can be one of these two objects {target:"", src:""} this will send to gulp-replace and second {buildName:replacement} buildName (string|RegExp) replacement (String|Array|Object). | | Debug | --- | Boolean | true, false | Enable gulp-plumber | | Wrapper | gulp-wrapper | ObjectArray | Each Object has two options header and footer. More Details | | Harmony/ES2015 | --- | Boolean | Set it true if you need ES6 support too. More Details | | Rename | gulp-rename | StringObjectFunction | You can edit the name or edit the path of your destination file. More Details | | Compress | gulp-uglifygulp-htmlmingulp-clean-css | BooleanObject | this will use gulp-uglify if ext is .js, gulp-htmlmin if ext is .html and gulp-clean-css if css is .css |

Log Options

  • log (string|bool) log/console content of stream. All options of glob-stream are supported. Default value is contents.
  • preLog (bool) console stream before processing. same as log above.
  • postLog (bool) console stream just before save(gulp.dest function) stream. same as log above.
  • get (function) Just in case if you want to get stream.NOTE it will not effect the stream.

Todo

License

MIT