Last active
September 2, 2016 13:01
-
-
Save jsakamoto/ce0bd81fb36628d594a81b76593f0cd1 to your computer and use it in GitHub Desktop.
オレの gulp
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
node_modules |
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
[ | |
{ | |
"outputFileName": "bundle.js", | |
"inputFiles": [ | |
"./src/**/*.js" | |
] | |
} | |
] |
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
var gulp = require('gulp'); | |
var ngAnnotate = require('gulp-ng-annotate'); | |
var uglify = require('gulp-uglify'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var concat = require('gulp-concat'); | |
var merge = require('merge-stream'); | |
var bundleconfig = require('./bundleconfig.json'); | |
gulp.task('min:js', () => { | |
var tasks = bundleconfig.map(bundle => | |
gulp.src(bundle.inputFiles, { base: "." }) | |
.pipe(sourcemaps.init({ loadMaps: true })) | |
.pipe(concat(bundle.outputFileName)) | |
.pipe(ngAnnotate()) | |
.pipe(uglify()) | |
.pipe(gulp.dest(".")) | |
.pipe(sourcemaps.write("./")) | |
.pipe(gulp.dest(".")) | |
); | |
return merge(tasks); | |
}); | |
gulp.task('watch', () => { | |
bundleconfig.forEach(bundle => { | |
gulp.watch(bundle.inputFiles, ["min:js"]); | |
}); | |
}); |
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
{ | |
"name": "name", | |
"version": "1.0.0", | |
"description": "", | |
"devDependencies": { | |
"gulp": "^3.9.1", | |
"gulp-concat": "^2.6.0", | |
"gulp-ng-annotate": "^2.0.0", | |
"gulp-sourcemaps": "^1.6.0", | |
"gulp-uglify": "^2.0.0", | |
"merge-stream": "^1.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment