Create dynamically loaded gulp tasks that automatically load plugins.
$ npm install stimpak stimpak-gulp-babel -g
$ cd my-project-directory
$ stimpak gulp-babel
- Create a dynamic task file in the
./tasks
directory. - Install the gulp plugins you want to use normally via
npm
. - Use plugins without requiring or importing via the dynamic task.
- Gulp recognizes the new task automatically, so you can immediately use it on the command-line.
// ./tasks/do-something.js
module.exports = (gulp, plugins) => {
gulp.task("do-something", () => {
gulp.src("**/*.js")
.pipe(plugins.concat())
.pipe(gulp.dest("./dist/"));
});
};