Last active
October 28, 2015 20:14
-
-
Save byronferguson/c9a356bed98a08af490b to your computer and use it in GitHub Desktop.
Current Gulp build process
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
| { | |
| "prebuild": [ | |
| "angular", | |
| "angular-animate", | |
| "angular-ui-router", | |
| "angular-bootstrap", | |
| "angular-bootstrap-tpls", | |
| "angular-utf8-base64", | |
| "ng-fastclick" | |
| ], | |
| "paths": { | |
| "angular" : "bower_components/angular/angular.js", | |
| "angular-animate" : "bower_components/angular-animate/angular-animate.js", | |
| "angular-ui-router" : "bower_components/angular-ui-router/release/angular-ui-router.js", | |
| "angular-bootstrap" : "bower_components/angular-bootstrap/ui-bootstrap.js", | |
| "angular-bootstrap-tpls" : "bower_components/angular-bootstrap/ui-bootstrap-tpls.js", | |
| "angular-utf8-base64" : "bower_components/angular-utf8-base64/angular-utf8-base64.js", | |
| "ng-fastclick" : "bower_components/ng-fastclick/dist/index.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
| "devDependencies": { | |
| "angular-utf8-base64": "^0.0.2", | |
| "event-stream": "~3.3.1", | |
| "gulp": "^3.9.0", | |
| "gulp-angular-templatecache": "^1.7.0", | |
| "gulp-concat": "^2.6.0", | |
| "gulp-connect": "^2.2.0", | |
| "gulp-ng-annotate": "^1.0.0", | |
| "gulp-uglify": "^1.2.0" | |
| } |
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 es = require('event-stream'); | |
| var gulp = require('gulp'); | |
| var concat = require('gulp-concat'); | |
| var connect = require('gulp-connect'); | |
| var templateCache = require('gulp-angular-templatecache'); | |
| var ngAnnotate = require('gulp-ng-annotate'); | |
| var uglify = require('gulp-uglify'); | |
| var scripts = require('./app.scripts.json'); | |
| var source = { | |
| js: { | |
| main: 'app/main.js', | |
| src: [ | |
| // main module | |
| 'app/app.js', | |
| // module files | |
| 'app/**/module.js', | |
| // other js files [controllers, services, etc.] | |
| 'app/**/!(module)*.js', | |
| ], | |
| tpl: 'app/**/*.tpl.html' | |
| } | |
| }; | |
| var destinations = { | |
| js: 'build' | |
| }; | |
| gulp.task('build', function(){ | |
| return es.merge(gulp.src(source.js.src) , getTemplateStream()) | |
| .pipe(ngAnnotate()) | |
| // .pipe(uglify()) | |
| .pipe(concat('app.js')) | |
| .pipe(gulp.dest(destinations.js)); | |
| }); | |
| gulp.task('vendor', function(){ | |
| var paths = []; | |
| scripts.prebuild.forEach(function(script){ | |
| paths.push(scripts.paths[script]); | |
| }); | |
| gulp.src(paths) | |
| .pipe(concat('vendor.js')) | |
| //.on('error', swallowError) | |
| //.pipe(uglify()) | |
| .pipe(gulp.dest(destinations.js)) | |
| }); | |
| gulp.task('watch', function(){ | |
| gulp.watch(source.js.src, ['build']); | |
| gulp.watch(source.js.tpl, ['build']); | |
| }); | |
| gulp.task('connect', function() { | |
| connect.server({ | |
| port: 8080 | |
| }); | |
| }); | |
| //gulp.task('default', ['vendor', 'build', 'watch', 'connect']); | |
| gulp.task('default', ['vendor', 'build', 'watch']); | |
| var swallowError = function(error){ | |
| console.log(error.toString()); | |
| this.emit('end') | |
| }; | |
| var getTemplateStream = function () { | |
| return gulp.src(source.js.tpl) | |
| .pipe(templateCache({ | |
| root: 'app/', | |
| module: 'app' | |
| })) | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment