Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/blanzh/gulp-check-include
- Owner: blanzh
- Created: 2019-01-10T17:19:00.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-10T17:51:10.000Z (almost 6 years ago)
- Last Synced: 2024-09-28T17:04:41.806Z (3 months ago)
- Topics: gulp-plugin, helper, include, nodejs, nunjucks
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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();
}```