Git Product home page Git Product logo

gulp-manifold's Introduction

gulp-manifold

Provides a manifold for gulp object streams.

Splits a stream into ducts by applying filters, allowing ducts to specify their own piping into the Return. The Return from ducts are then merged with the Bypass for further piping.

The Bypass is comprised of anything that wasn't filtered.

------------
|  Stream  |
------------
     ||       FILTERS
------------    ||    ------------
| Manifold |>===|>===>|   Duct   |===>|
------------    ||    ------------   ||
              B ||                   || R
              Y ||    ------------   || E
              P |>===>|   Duct   |===>| T
              A ||    ------------   || U
              S ||                   || R
              S ||    ------------   || N
                |>===>|   Duct   |===>| 
                ||    ------------   ||
------------    ||                   ||
|  Stream  |<=MERGE<=================<|
------------

This is useful for applying different processing to subsets of the build, then applying further processing on the combined results as a whole. I.e., process js/css separately, then write them to disk simultaneously with a single call to gulp.dest(path).

Example 1:

var gulp = require('gulp'),
    manifold = require('gulp-manifold'),
    uglify = require('gulp-uglify'),
    sass = require('gulp-sass');
    
    gulp.task('default', function () {
    
        return gulp.src('src/**/*')
            .pipe(manifold({
            
                '**/*.js': function (ductStream) {
                    
                    // Note: always return a stream to the Return
                    return ductStream
                        .pipe(uglify());
                    
                },
                
                '**/*.scss': function (ductStream) {

                    // Note: always return a stream to the Return
                    return ductStream
                        .pipe(sass())
                        
                }
                
            }))
            .pipe(gulp.dest('dist'));
            
    });

Example 2:

var gulp = require('gulp'),
    manifold = require('gulp-manifold'),
    uglify = require('gulp-uglify'),
    sass = require('gulp-sass');
    
    gulp.task('default', function () {
    
        return gulp.src('src/**/*')
            .pipe(manifold([
            
                manifold.duct([
                    'src/**/*.js',
                    'lib/**/*.js'
                ], function (ductStream) {
                    
                    // Note: always return a stream to the Return
                    return ductStream
                        .pipe(uglify());
                    
                }),
                
                manifold.duct('**/*.scss', function (ductStream) {

                    // Note: always return a stream to the Return
                    return ductStream
                        .pipe(sass())
                        
                })
                
            ]))
            .pipe(gulp.dest('dist'));
            
    });

gulp-manifold's People

Contributors

tniswong avatar

Stargazers

 avatar  avatar

Watchers

 avatar

gulp-manifold's Issues

License

I noticed you didn't attach a license to this project. Is that intentional in that others can't use it?
If not, can you please add one, so people can use this module?
If you need help, https://choosealicense.com/ has a pretty good run-down on the most popular ones for open source projects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.