-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
66 lines (54 loc) · 1.58 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
(function() {
'use strict';
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var path = require('path');
var karma = require('karma');
var gulpConcat = require('gulp-concat');
var gulpRename = require('gulp-rename');
var gulpUglify = require('gulp-uglify');
var gulpSourcemaps = require('gulp-sourcemaps');
gulp.task('browser-sync', function(cb) {
browserSync.init({
server: {
baseDir: './src',
files: ['**/*.html', '**/*.js', '**/*.css'],
logLevel: 'debug'
},
port: 8000
}, cb);
});
gulp.task('dev', [
'browser-sync'
], function() {
gulp.watch('src/**/*.html', function(event) {
browserSync.reload(path.relative(__dirname, event.path));
});
gulp.watch('src/**/*.js', function(event) {
browserSync.reload(path.relative(__dirname, event.path));
});
gulp.watch('src/**/*.css', function(event){
browserSync.reload(path.relative(__dirname, event.path));
});
});
gulp.task('test', function(cb) {
new karma.Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, cb).start();
});
gulp.task('build', function(){
return gulp.src(['src/app.js', 'src/modules/**/*.js'])
.pipe(gulpSourcemaps.init())
.pipe(gulpConcat('release.js'))
.pipe(gulp.dest('dist'))
.pipe(gulpRename('release.min.js'))
.pipe(gulpUglify())
.pipe(gulpSourcemaps.write('./'))
.pipe(gulp.dest('dist'));
});
//gulp.task('build', ['build'], function(){});
gulp.task('default', [
'dev'
]);
})();