1.0.1 • Published 10 years ago
gulp-file-process v1.0.1
gulp-file-process
Process file with pipe interface without creating special task
Getting started
ES2015, NODE 5+
To install gulp-file-process from npm, run:
npm install gulp-file-process --save-devUse the library:
const gulpFileProcess = require('gulp-file-process');
gulp.task('someTask', () =>
gulp.src('**/*')
.pipe(gulpFileProcess({
process: (file, content) => content.replace('some', 'any') // do something useful
run: (file) => { console.log(file.path); } // do something else, for instance notify user about processed file
}))
.pipe(gulp.dest('/some/path'))
);Options
options.read(file)
Type Function, Default (file) => file.contents.toString('utf8')
This function can returns promise
options.write(file, processedContent)
Type Function, Default (file, content) => { file.contents = new Buffer(content, 'utf8'); }
This function can returns promise
options.run(file)
Type Function, Default null
This function can returns promise
options.process(file, content)
Type Boolean, Default false
This function can returns promise
Enjoy!
Support
If you have any problems, you cached a bug, or you have any suggestion - please find an existing issue or create new
Contributing
If you want to develop this library do not be shy - Do that! How to contribute open-source projects
1.0.1
10 years ago