Created
January 18, 2015 13:52
-
-
Save pmcalabrese/760aa0f8fcf65fcd0c7a to your computer and use it in GitHub Desktop.
gulpfile used for copenhagenjs presentation. Based on the angular-seed example repository
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
// include gulp | |
var gulp = require('gulp'); | |
// include plug-ins | |
var concat = require('gulp-concat'); | |
var uglify = require('gulp-uglify'); | |
var minifyCSS = require('gulp-minify-css'); | |
var argv = require('yargs').argv; | |
var gulpif = require('gulp-if'); | |
var logwarn = require('gulp-logwarn'); | |
var psi = require('psi'); | |
var jsLibsFiles = [ | |
"app/bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js", | |
"app/bower_components/angular/angular.js", | |
"app/bower_components/angular-route/angular-route.js" | |
]; | |
var jsAppFiles = [ | |
"app/app.js", | |
"app/view1/view1.js", | |
"app/view2/view2.js", | |
"app/components/version/version.js", | |
"app/components/version/version-directive.js", | |
"app/components/version/interpolate-filter.js" | |
]; | |
var cssFiles = [ | |
"app/bower_components/html5-boilerplate/css/normalize.css", | |
"app/bower_components/html5-boilerplate/css/main.css", | |
"app/app.css" | |
]; | |
var partialsFiles = [ | |
"app/view*/*.html" | |
]; | |
var index = [ | |
"app/index_dist.html", | |
]; | |
gulp.task('default',['libs','app','css','partials','index']); | |
gulp.task('libs', function() { | |
gulp.src(jsLibsFiles) | |
.pipe(concat('libs.js')) | |
.pipe(gulpif(argv.production, uglify())) | |
.pipe(gulp.dest('./dist/js/')); | |
}); | |
gulp.task('app', function() { | |
gulp.src(jsAppFiles) | |
.pipe(logwarn()) | |
.pipe(concat('app.js')) | |
.pipe(gulpif(argv.production, uglify())) | |
.pipe(gulp.dest('./dist/js/')); | |
}); | |
gulp.task('css', function() { | |
gulp.src(cssFiles) | |
.pipe(concat('all.css')) | |
.pipe(gulpif(argv.production, minifyCSS())) | |
.pipe(gulp.dest('./dist/css/')); | |
}); | |
gulp.task('partials', function() { | |
gulp.src(partialsFiles) | |
.pipe(gulp.dest('./dist/')); | |
}); | |
gulp.task('index', function() { | |
gulp.src(index) | |
.pipe(concat("index.html")) | |
.pipe(gulp.dest('./dist/')); | |
}); | |
gulp.task('psi',function(cb) { | |
var options = { | |
strategy:"desktop" | |
}; | |
psi.output('https://www.comparo.dk/rejseforsikring',options, function (err) { | |
if (err) { | |
console.log('ERROR:',err); | |
return; | |
} | |
console.log('done'); | |
},cb); | |
}); | |
// Reload only when development files has changed | |
gulp.task('watch', ['default'], function () { | |
gulp.watch(jsLibsFiles, ['libs']); | |
gulp.watch(jsAppFiles, ['app']); | |
gulp.watch(cssFiles, ['css']); | |
gulp.watch(partialsFiles, ['partials']); | |
gulp.watch(index, ['index']); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment