Skip to content

Deep dependency recursive modified time comparison to ensure your files only re-compile when needed

License

Notifications You must be signed in to change notification settings

ladjs/gulp-haschanged-deps-async

Repository files navigation

gulp-haschanged-deps-async

build status code coverage code style styled with prettier made with lass license

Provides a hasChanged function for use with gulp-changed to check mtimes of a file's dependencies.

This package is a modern and updated fork of gulp-haschanged-deps and as such I've retained the original author's licensing as it was inspired by his work.

Table of Contents

Install

npm:

npm install gulp-haschanged-deps-async

yarn:

yarn add gulp-haschanged-deps-async

Usage

const gulp = require('gulp');
const filter = require('gulp-custom-filter');
const hasChangedDepsAsync = require('gulp-haschanged-deps-async');
const less = require('gulp-less');

gulp.task('less', () => {
  return (
    gulp
      .src(['less/**/*.less'])
      .pipe(
        filter(
          hasChangedDepsAsync('css', {
            // the cwd option is for resolving paths to packages
            // and it defaults to the directory process is running from
            cwd: process.cwd(),
            // an optional extension you can pass if the file extension changes
            extension: '.css',
            // this is optional option, but useful for specifying directly
            // so that no auto-detection is required by `precinct`
            // <https://github.com/dependents/node-precinct>
            precinct: {
              type: 'less'
            }
          })
        )
      )
      .pipe(sourcemaps.init())
      .pipe(less())
      .pipe(sourcemaps.write('.'))
      .pipe(gulp.dest('css'))
  );
});

Contributors

Name Website
Nick Baugh http://niftylettuce.com/

License

MIT © Matt Powell

About

Deep dependency recursive modified time comparison to ensure your files only re-compile when needed

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published