-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
83 lines (77 loc) · 2.73 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* Comentanto funciones usando estilo JSDoc http://usejsdoc.org/
* gulp - Automatizador flujo de trabajo en el front-End
* webserver - https://www.npmjs.com/package/gulp-webserver
*/
var gulp = require('gulp')
var webserver = require('gulp-webserver')
var minify = require('gulp-minifier')
//var babel = require('gulp-babel')
var merge = require('merge-stream')
gulp.task('webserver', function() {
gulp.src('app')
.pipe(webserver({
host: 'localhost',
port: 3000,
livereload: true,
directoryListing: false,
open: true,
proxies: [{
source: '/arcgis',
target: 'http://acueducto.incige.com/arcgis',
options: {
headers: {
'DEVELOPER': 'juusechec'
}
}
}]
}))
})
/*
// https://www.youtube.com/watch?v=TGiBG6II6Jk
gulp.task('watch', ['sass'], function (){
gulp.watch('./sass/**\/*.css', ['sass'])
});
*/
gulp.task('minify', function() {
var allfiles = gulp.src(['app/**/*', '!app/vendor/**/*'])
.pipe(minify({
minify: true,
collapseWhitespace: true,
conservativeCollapse: true,
minifyJS: true,
minifyCSS: true,
getKeptComment: function(content, filePath) {
var m = content.match(/\/\*![\s\S]*?\*\//img);
return m && m.join('\n') + '\n' || '';
}
}))
.pipe(gulp.dest('dist/app'))
// http://stackoverflow.com/questions/34398338/uglification-failed-unexpected-character
// var jsfiles = gulp.src(['app/**/*.js', '!app/vendor/**/*', '!app/js/mustache-dojo.js'])
// .pipe(babel({
// presets: ['es2015']
// }))
// .pipe(minify({
// minify: true,
// collapseWhitespace: true,
// conservativeCollapse: true,
// minifyJS: true,
// minifyCSS: true,
// getKeptComment: function(content, filePath) {
// var m = content.match(/\/\*![\s\S]*?\*\//img);
// return m && m.join('\n') + '\n' || '';
// }
// }))
// .pipe(gulp.dest('dist/app'))
var vendorfiles = gulp.src(['app/vendor/**/*'])
.pipe(gulp.dest('dist/app/vendor'))
// var exeptionfiles = gulp.src(['app/js/mustache-dojo.js'])
// .pipe(gulp.dest('dist/app/js'))
// https://github.com/gulpjs/gulp/blob/master/docs/recipes/using-multiple-sources-in-one-task.md
return merge(allfiles, vendorfiles)
})
//https://github.com/andresvia/go-angular-drone/blob/master/.drone.yml
gulp.task('default', ['webserver'], function() {
// place code for your default task here
})