Created
June 7, 2016 13:40
-
-
Save devintyler/74699b9f2275747c18c16cbe4d25a857 to your computer and use it in GitHub Desktop.
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
var gulp = require('gulp'); | |
var rename = require('gulp-rename'); | |
var minHTML = require('gulp-minify-html'); | |
var minCss = require('gulp-minify-css'); | |
var minJs = require('gulp-uglify'); | |
var replace = require('gulp-replace'); | |
var concat = require('gulp-concat'); | |
gulp.task('watch-js', function(){ | |
gulp.watch(['./public/js/ordego.js', './public/js/cart.js', './public/controllers/controllers.js'], ['min-js']); | |
}); | |
gulp.task('watch-css', function(){ | |
gulp.watch(['./public/css/app.css'], ['min-css']); | |
}); | |
gulp.task('watch-ctrl', function(){ | |
gulp.watch(['./public/controllers/individual/*.js'], ['min-js']); | |
}); | |
gulp.task('watch-html', function(){ | |
gulp.watch(['./public/views/pages/*.html'], ['min-html']); | |
}); | |
gulp.task('min-html', function(){ | |
gulp.src('./public/views/pages/*.html') | |
.pipe(minHTML()) | |
.pipe(rename({suffix: '.min'})) | |
.pipe(gulp.dest('./public/views',[{overwrite:true}])); | |
}); | |
gulp.task('min-css', function(){ | |
gulp.src(['./public/css/foundation.css', './public/css/app.css']) | |
.pipe(concat('ordego-app.css')) | |
.pipe(gulp.dest('./public/css',[{overwrite:true}])); | |
gulp.src('./public/css/ordego-app.css') | |
.pipe(minCss()) | |
.pipe(rename({suffix: '.min'})) | |
.pipe(gulp.dest('./public/css',[{overwrite:true}])); | |
}); | |
gulp.task('min-js', function(){ | |
gulp.src(['./public/js/ordego.js', './public/js/cart.js']) | |
.pipe(concat('ordego-app.js')) | |
.pipe(gulp.dest('./public/js',[{overwrite:true}])); | |
gulp.src('./public/js/ordego-app.js') | |
.pipe(minJs()) | |
.pipe(rename({suffix: '.min'})) | |
.pipe(gulp.dest('./public/js',[{overwrite:true}])); | |
gulp.src('./public/controllers/individual/*.js') | |
.pipe(concat('controllers.js')) | |
.pipe(gulp.dest('./public/controllers',[{overwrite:true}])); | |
gulp.src('./public/controllers/controllers.js') | |
.pipe(minJs()) | |
.pipe(rename({suffix: '.min'})) | |
.pipe(gulp.dest('./public/controllers',[{overwrite:true}])); | |
}); | |
gulp.task('dev-api', function(){ | |
gulp.src(['./public/index.html']) | |
.pipe(replace('jBqHIOqxAe9fhvIYb7KQE6PL7KMh1Ohr', 'rXI7T0PiRyWNEAlUjG9WLtVAhsLMi0T5')) // JS analytics | |
.pipe(gulp.dest('./public')); | |
gulp.src(['./index.js']) | |
.pipe(replace('3uZZNGR7SEETVLVBsYFw9mFJvi0KlBEO', 'rUdnbutWVjswtLkCljogeIzE8bFmISgN')) // Server analytics | |
.pipe(replace('https://api.syncano.io/v1/instances/winter-waterfall-3498/webhooks/p/1c1b3232afd116dc96a7c60632e61d8ffaf77e5c/posttransaction/', | |
'https://api.syncano.io/v1/instances/winter-waterfall-3498/webhooks/p/eeba5ec819529a712040f130a7f24a827ee78fbd/dev-posttransaction/')) | |
.pipe(replace('braintree.Environment.Production', 'braintree.Environment.Sandbox')) // BT replace | |
.pipe(replace('54rd32gmz5p23vg5', '85b8wbgy6hmdnxxq')) | |
.pipe(replace('95xmpyjhkxvvh955', 'xvd4pw537pmfysf9')) | |
.pipe(replace('41c02d730be1b2966e7d75890bbac443', 'baf04596f86881e7e77f7afbf6a10094')) | |
.pipe(gulp.dest('./',[{overwrite:true}])); | |
}); | |
gulp.task('prod-api', function(){ | |
gulp.src(['./public/index.html']) | |
.pipe(replace('rXI7T0PiRyWNEAlUjG9WLtVAhsLMi0T5', 'jBqHIOqxAe9fhvIYb7KQE6PL7KMh1Ohr')) // JS analytics | |
.pipe(gulp.dest('./public')); | |
gulp.src(['./index.js']) | |
.pipe(replace('rUdnbutWVjswtLkCljogeIzE8bFmISgN', '3uZZNGR7SEETVLVBsYFw9mFJvi0KlBEO')) // Server analytics | |
.pipe(replace('https://api.syncano.io/v1/instances/winter-waterfall-3498/webhooks/p/eeba5ec819529a712040f130a7f24a827ee78fbd/dev-posttransaction/', | |
'https://api.syncano.io/v1/instances/winter-waterfall-3498/webhooks/p/1c1b3232afd116dc96a7c60632e61d8ffaf77e5c/posttransaction/')) | |
.pipe(replace('braintree.Environment.Sandbox', 'braintree.Environment.Production')) // BT replace | |
.pipe(replace('85b8wbgy6hmdnxxq', '54rd32gmz5p23vg5')) | |
.pipe(replace('xvd4pw537pmfysf9', '95xmpyjhkxvvh955')) | |
.pipe(replace('baf04596f86881e7e77f7afbf6a10094', '41c02d730be1b2966e7d75890bbac443')) | |
.pipe(gulp.dest('./',[{overwrite:true}])); | |
}); | |
gulp.task('watch', ['watch-js', 'watch-css', 'watch-ctrl', 'watch-html']); | |
gulp.task('build', ['min-css', 'min-js', 'min-html', 'prod-api']); | |
gulp.task('build-dev', ['min-css', 'min-js', 'min-html', 'dev-api']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment