Last active
January 2, 2016 03:59
-
-
Save mikaelbr/8247656 to your computer and use it in GitHub Desktop.
Possible gulp plugin for having independent sub directories.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var es = require("event-stream"), | |
path = require("path"), | |
gulp = gulp("fs"); | |
var dest = module.exports = function (matcher) { | |
"use strict"; | |
function dest(file, callback) { | |
if (file.isNull()) return cb(null, file); // pass along | |
if (!matcher) { | |
callback(new Error("gulp-subdir: No subdirectory specified"), undefined); | |
} | |
var writePath = path.join(path.dirname(file.path), matcher); | |
return gulp.dest(writePath)(file, callback); | |
} | |
return es.map(subdir); | |
}; | |
// Usage: | |
gulp.src("someDirectory/*/*.less") | |
.pipe(less()) | |
.pipe(dest("./")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment