-
Notifications
You must be signed in to change notification settings - Fork 9
/
gulpfile.js
80 lines (65 loc) · 1.94 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var minifycss = require('gulp-minify-css');
var Server = require('karma').Server;
var jshint = require('gulp-jshint');
var connect = require('gulp-connect');
// *******************************************
gulp.task('buildApp', function(){
return gulp.src('src/js/**/*.js')
.pipe(concat('app.js'))
.pipe(uglify())
.pipe(gulp.dest('dist'))
.pipe(connect.reload());
});
gulp.task('buildVendor', function(){
return gulp.src([
'bower_components/jquery/dist/jquery.min.js',
'bower_components/**/*.min.js'])
.pipe(concat('vendors.js'))
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
gulp.task('buildCSS', function(){
return gulp.src([
'bower_components/bootstrap/dist/css/bootstrap.css',
'src/css/**/*.css'])
.pipe(concat('styles.css'))
.pipe(minifycss())
.pipe(gulp.dest('dist'))
.pipe(connect.reload());
});
gulp.task('moveHTML', function(){
return gulp.src('src/**/*.html')
.pipe(gulp.dest('dist'))
.pipe(connect.reload());
});
gulp.task('build', ['buildApp', 'buildVendor', 'buildCSS', 'moveHTML']);
// **********************************
gulp.task('karma', function (done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
gulp.task('jshint', function(){
return gulp.src(['src/js/**/*.js', 'src/tests/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('test', ['karma', 'jshint']);
// ***************************************
gulp.task('connect', function(){
connect.server({
root: 'dist',
livereload: true
});
});
gulp.task('watch', function(){
gulp.watch('src/js/**/*.js', ['buildApp']);
gulp.watch('src/css/**/*.css', ['buildCSS']);
gulp.watch('src/**/*.html', ['moveHTML']);
});
// *******************************************
gulp.task('default', ['build', 'test', 'watch', 'connect']);