Created
February 17, 2014 19:51
-
-
Save yocontra/9057715 to your computer and use it in GitHub Desktop.
folder concat
This file contains hidden or 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
// pseudocode but something like this | |
var fs = require('fs'); | |
var path = require('path'); | |
var gulp = require('gulp'); | |
var concat = require('gulp-concat'); | |
var gif = require('gulp-if'); | |
function getFolders(dir){ | |
return fs.readdirSync(dir) | |
.filter(function(file){ | |
return fs.statSync(name).isDirectory(); | |
}); | |
} | |
gulp.task('js', function(){ | |
var folders = getFolders("./parent-folder"); | |
var src = gulp.src("./parent-folder/**/*.js"); | |
var dest = gulp.dest("build/whatever"); | |
folders.forEach(function(folder){ | |
src | |
.pipe(gif(folder+"/*.js", concat(folder+".js"))) | |
.pipe(dest); | |
}); | |
return dest; | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment