-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
71 lines (59 loc) · 1.58 KB
/
gulpfile.js
File metadata and controls
71 lines (59 loc) · 1.58 KB
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
var gulp = require('gulp');
var gulpLoadPlugins = require('gulp-load-plugins');
var plugins = gulpLoadPlugins();
var runSequence = require('run-sequence');
var del = require('del');
var join = require('path').join;
var DIST_DIR = 'dist';
var SRC_DIR = 'src';
// ----- build -----
gulp.task('build', function(done) {
runSequence(
'clean',
'build.html',
'build.css',
'build.js',
done);
});
// ----- build.watch -----
// Not working very well. It appears that lite server is trying to refresh
// while the build process is still building.
gulp.task('build.watch', function(done) {
runSequence(
'build',
'watch',
done);
});
// ----- clean -----
gulp.task('clean', function() {
return del([DIST_DIR]);
});
// ----- build.html -----
gulp.task('build.html', function() {
return gulp.src(join(SRC_DIR, '**/*.html'))
.pipe(gulp.dest(DIST_DIR));
});
// ----- build.css -----
gulp.task('build.css', function() {
return gulp.src(join(SRC_DIR, '**/*.css'))
.pipe(gulp.dest(DIST_DIR));
});
// ----- build.js -----
gulp.task('build.js', function() {
var tsProject = plugins.typescript.createProject('tsconfig.json', {
typescript: require('typescript')
});
var src = [
'typings/browser.d.ts',
'src/**/*.ts'
];
return gulp.src(src)
.pipe(plugins.typescript(tsProject))
.pipe(gulp.dest(DIST_DIR));
});
// ----- watch -----
gulp.task('watch', function(done) {
plugins.watch(join(SRC_DIR, '**'), function() {
runSequence('build', done);
});
});