Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/blanzh/gulp-check-include

Filter files by content
https://github.com/blanzh/gulp-check-include

gulp-plugin helper include nodejs nunjucks

Last synced: about 1 month ago
JSON representation

Filter files by content

Awesome Lists containing this project

README

        

# gulp-check-include
Filter files by content

## Usage

```javascript
var gulp = require('gulp');
var filter = require('gulp-check-include');

gulp.src('./src/*.html')
.pipe(filter("I love this file"))
```
Or my use case for optimize render by nunjucks:

```javascript
function WatchHtml(dir, fname) {
return gulp.src(dir)
.pipe(gulpif(fname !== undefined, filter(fname)))
.pipe(njkRender({
path: 'src/partials'
}))
.pipe(gulp.dest('./build'));
}

function watcher(cb) {
gulp.watch('./src/**/*.njk').on('change', function (file) {

if (file.includes("src\\partials\\")) {
WatchHtml('./src/*.njk', pth.basename(file));
} else {
WatchHtml(file);
}

});
cb();
}

```