forked from repl-rebels/Koupler
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Gulpfile.js
77 lines (66 loc) · 2.23 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
var gulp = require('gulp'),
nodemon = require('gulp-nodemon'),
karma = require('gulp-karma'),
bs = require('browser-sync'),
reload = bs.reload,
when = require('gulp-if'),
shell = require('gulp-shell'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
clean = require('gulp-clean'),
gutil = require('gulp-util'),
filesize = require('gulp-filesize');
var jsScripts = [
'client/bower_components/angular/angular.min.js',
'client/bower_components/angular-ui-router/release/angular-ui-router.min.js',
'client/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
'client/bower_components/ng-file-upload/ng-file-upload.min.js',
'client/app/app.js',
'client/index.js',
'client/app/**/*.js'
];
// the paths to our app files
var paths = {
// all our client app js files, not including 3rd party js files
scripts: ['client/app/**/*.js', 'client/index.js'],
html: ['client/app/**/*.html', 'client/index.html'],
styles: ['client/bower_components/bootstrap/dist/css/bootstrap.min.css', 'client/styles/*.css'],
test: ['specs/**/*.js']
};
gulp.task('clean', function() {
return gulp.src('build', {
read: false
})
.pipe(clean());
});
gulp.task('karma', shell.task([
'karma start'
]));
gulp.task('convert-js', function() {
//specifc order
return gulp.src(jsScripts)
.pipe(concat('koupler.min.js', {newLine: '\n'}))
.pipe(uglify())
.pipe(gulp.dest('build/'))
.pipe(filesize())
.on('error', gutil.log);
});
gulp.task('copy-css', function(){
gulp.src(paths.styles, { base: './'})
.pipe(gulp.dest('./build/styles'));
});
gulp.task('copy-html', function(){
gulp.src('client/app/**/*.html', { base: './client/' })
.pipe(gulp.dest('./build/'));
});
gulp.task('move-index', function(){
gulp.src('client/index_gulp.html')
.pipe(rename('index.html'))
.pipe(gulp.dest('./build/'));
});
gulp.task('serve', function() {
nodemon({script: 'index.js', ignore: 'node_modules/**/*.js'});
});
gulp.task('default', ['convert-js', 'copy-html', 'copy-css', 'move-index']);
gulp.task('build', ['karma', 'convert-js', 'copy-html', 'copy-css', 'move-index']);