gld

gulp-less-dependents

Collect dependents of less files

Showing:

Popularity

Downloads/wk

476

GitHub Stars

5

Maintenance

Last Commit

7yrs ago

Contributors

1

Package

Dependencies

3

Size (min+gzip)

57.5KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

gulp-less-dependents Build Status

Collect dependents of less files

Gives you a chance to recompile less files on modification of a file which those files are depending on.

Install

npm install gulp-less-dependents

Usage

var gulp = require('gulp');
var watch = require('gulp-watch');
var lessDependents = require('gulp-less-dependents');
var less = require('gulp-less');

gulp.task('less', function() {
    gulp.src('./less/**/*.less')
        .pipe(watch('./less/**/*.less'))
        .pipe(lessDependents())
        .pipe(less())
        .pipe(gulp.dest('./public/css'));
});

lessDependents() analyzes dependencies of files passed from the upstream, and passes files that are (1) passed from the upstream, or (2) depending on files from the upstream. For the files of (2), they must be once a target of analysis earlier; it means that files of (2) are included in those of (1) for the first time. In the example above shows that src() gives files of (1), and files of (2) are triggered by watch() after the first run.

If you wish to exclude the depended files from compilation but want to watch them for recompilation of the dependents, use gulp-filter for the exclusion. For example, if you have depended files in ./less/includes, the task may look like the following.

var gulp = require('gulp');
var watch = require('gulp-watch');
var gulpFilter = require('gulp-filter');
var lessDependents = require('gulp-less-dependents');
var less = require('gulp-less');

gulp.task('less', function() {
    gulp.src('./less/**/*.less')
        .pipe(watch('./less/**/*.less'))
        .pipe(lessDependents())
        .pipe(gulpFilter([ '*', '!less/includes/*.less' ]))
        .pipe(less())
        .pipe(gulp.dest('./public/css'));
});

API

lessDependents([options])

options

This object is passed to less.Parser internally used for dependency analysis.

License

MIT (c) INA Lintaro (tarao.gnn@gmail.com)

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100