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.
npm:
npm install gulp-haschanged-deps-async
yarn:
yarn add gulp-haschanged-deps-async
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'))
);
});
Name | Website |
---|---|
Nick Baugh | http://niftylettuce.com/ |
MIT © Matt Powell