forked from codebar/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
48 lines (44 loc) · 1.13 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
var
browsersync = require('browser-sync').create(),
concat = require('gulp-concat'),
gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
uglify = require('gulp-uglify'),
paths = {
jsdev: [
'./javascripts-dev/vendor/jszip.js',
'./javascripts-dev/vendor/jszip-utils.js',
'./javascripts-dev/vendor/FileSaver.js',
'./javascripts-dev/src/downloader.js',
'./javascripts-dev/src/zipper.js',
'./javascripts-dev/src/ui.js',
'./javascripts-dev/main.js',
],
jsdist: './javascripts/',
};
gulp.task('js', function() {
return gulp
.src(paths.jsdev)
.pipe(sourcemaps.init())
.pipe(concat('downloader-bundle.js'))
.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.jsdist));
});
gulp.task('watch', function() {
gulp.watch(paths.jsdev, ['js']);
});
gulp.task('server', function() {
browsersync.init({
server: {
baseDir: './',
routes: {
"/test" : 'javascripts-dev'
}
},
port: 4000,
notify: false,
open: false
});
});
gulp.task('default', ['js', 'watch', 'server']);