Skip to content

Instantly share code, notes, and snippets.

@IvanTorresEdge
Forked from heldr/gulpfile.js
Created April 18, 2016 16:00
Show Gist options
  • Save IvanTorresEdge/0da6fd36bb7331b6551d898fdf4b8034 to your computer and use it in GitHub Desktop.
Save IvanTorresEdge/0da6fd36bb7331b6551d898fdf4b8034 to your computer and use it in GitHub Desktop.
Another way of splitting a gulpfile into multiple files
/*
Another way of splitting a gulpfile into multiple files based on:
http://macr.ae/article/splitting-gulpfile-multiple-files.html
https://github.com/gulpjs/gulp/blob/master/docs/recipes/split-tasks-across-multiple-files.md
*/
'use strict';
var gulp = require('gulp'),
plugins = require('gulp-load-plugins')(),
taskPath = './tasks/',
// async readdir does not identify task names
taskList = require('fs').readdirSync(taskPath);
taskList.forEach(function (taskFile) {
// or .call(gulp,...) to run this.task('foobar')...
require(taskPath + taskFile)(gulp, plugins);
});
module.exports = function (gulp, $) {
'use strict';
gulp.task('styles', function () {
return gulp.src(['app/public/scss'], { dot: false })
.pipe($.sass())
.pipe(gulp.dest('dist/css'))
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment