gulp-haschanged-deps-async

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

Usage no npm install needed!

<script type="module">
  import gulpHaschangedDepsAsync from 'https://cdn.skypack.dev/gulp-haschanged-deps-async';
</script>

README

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