UNPKG

stream-render-pipeline

Version:

File generation strategy for working with creating/modifying files using gulp

50 lines (42 loc) 734 B
const lazypipe = require('lazypipe'); const gulpPlugins = require('auto-plug')('gulp'); class Srp { constructor(opts) { this.opts = opts; } /** * Files */ src(cwd, glob) { return lazypipe().pipe(gulpPlugins.addSrc, this.tplPath(cwd, glob)) } /** * Templating */ tpl(data) { return lazypipe().pipe(gulpPlugins.template, data); } /** * Pre-rendered */ pre(destPath, fileContents) { return lazypipe().pipe(gulpPlugins.file, destPath, fileContents); } /** * Rename files and folders */ get rename() { return gulpPlugins.rename; } tplPath(cwd, relativePath) { return `${cwd}/../templates/${relativePath}`; } } module.exports = Srp;