Code Monkey home page Code Monkey logo

gulp-diff-build's Introduction

badge

gulp-diff-build

gulp module to stream files only if target files are changed.

Getting Started

Install

$ npm install @moshisora/gulp-diff-build --save-dev

Usage

This task will keep a hash reference of target files and run defined tasks only if files changed. File hashes will be saved in .gulp/gulp-diff-build/hash.json. You might like to add .gulp to your .gitignore.

const diff = require('gulp-diff-build');

const SRC = 'src';
const DEST = 'dist';

gulp.task('default', () => {
    gulp.src(SRC)
        .pipe(diff())
        .pipe(gulp.dest(DEST));
});

Options

clear

Type: bool Default value: false

flush hash file when running with clear option value: true

clearAll

Type: bool Default value: false

flush all hash files when running with clearAll option value: true

dest

Type: string or array Default value: undefined

option to filter streaming files. This task will stream only files that match given paths into the gulp stream. If it is undefined, all files will be passed.

hash

Type: string Defualt value: 'hash'

options to define filename of hash references for multi tasking or multi cache control. files of hash references will be saved as .gulp/gulp-diff-build/[givenName].json.

Example

example of building sass.

gulp task watch all of sass src files and stream only main.sass and main-sp.sass into sass() task.

const diff = require('gulp-diff-build');

gulp.task('default', () => {
    gulp.src('src/sass/**/*.sass')
        .pipe(diff({
            clean: true,
            dest: [
                'src/sass/main.sass',
                'src/sass/main-sp.sass'
            ],
            hash: 'sass'
        }))
        .pipe(sass()),
        .pipe(gulp.dest('dest'));
});

License

The MIT License (MIT)

Copyright 2016~ moshisora

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.