-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathgulpfile.js
77 lines (65 loc) · 1.77 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
// #hack for fix Promise is not defined from gulp-usemin
// global.Promise = require('bluebird');
var gulp = require('gulp'),
rename = require("gulp-rename"),
connect = require('gulp-connect');
coffee = require('gulp-coffee'),
gutil = require('gulp-util'),
uglify = require('gulp-uglify'),
debug = require('gulp-debug'),
del = require('del'),
pump = require('pump'),
concat = require('gulp-concat-util'),
Server = require('karma').Server;
gulp.task('test', function (done) {
new Server({
configFile: __dirname + '/karma.conf.coffee',
singleRun: true
}, done).start();
});
gulp.task('clean:dist', function (cb) {
console.log('Cleaning dist/ ...');
return del([
'dist/**/*',
], cb);
});
gulp.task('clean:tmp', ['clean:dist'], function (cb) {
console.log('Cleaning tmp/ ...');
return del([
'tmp/**/*',
], cb);
});
gulp.task('coffee:dist', ['clean:tmp'], function() {
return gulp.src(['./src/**', '!./src/**/*.spec.coffee'])
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(gulp.dest('./tmp/'));
});
gulp.task('compress', ['coffee:dist'], function(cb) {
pump([
gulp.src('./tmp/**/*.js'),
debug({title: 'Files:'}),
concat.scripts('angular-viacep.min.js'),
uglify(),
gulp.dest('dist/')
],
cb
);
// return gulp.src()
// .pipe(debug({title: 'unicorn:'}))
// uglify()
// // .pipe(rename({
// // suffix: '.min'
// // }))
// .pipe(gulp.dest('dist'));
});
gulp.task('serve', function() {
connect.server({
root: ['demo','tmp', 'dist'],
livereload: true
});
});
gulp.task('watch', function () {
gulp.watch(['./src/**/*'], ['dist']);
});
gulp.task('default', ['serve', 'watch']);
gulp.task('dist',['compress']);