Created
September 16, 2014 15:08
-
-
Save kbshl/643eaf834f8cbeade3d7 to your computer and use it in GitHub Desktop.
Gulp Receipe: Using external config file
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
{ | |
"desktop" : { | |
"src" : [ | |
"dev/desktop/js/**/*.js", | |
"!dev/desktop/js/vendor/**" | |
], | |
"dest" : "build/desktop/js" | |
}, | |
"mobile" : { | |
"src" : [ | |
"dev/mobile/js/**/*.js", | |
"!dev/mobile/js/vendor/**" | |
], | |
"dest" : "build/mobile/js" | |
} | |
} |
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
// Beneficial because it's keeping tasks DRY and config.json can be used by another task runner, like grunt. | |
// npm install --save-dev gulp gulp-uglify | |
var gulp = require('gulp'); | |
var uglify = require('gulp-uglify'); | |
var config = require('./config.json'); | |
function doStuff(cfg) { | |
return gulp.src(cfg.src) | |
.pipe(uglify()) | |
.pipe(gulp.dest(cfg.dest)); | |
} | |
gulp.task('dry', function() { | |
doStuff(config.desktop); | |
doStuff(config.mobile); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment