-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
68 lines (60 loc) · 1.56 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
'use strict';
var gulp = require('gulp');
var less = require('gulp-less');
var ts = require('gulp-typescript');
var merge = require('merge2');
var browserify = require('gulp-browserify');
var child_process = require("child_process");
// var debug = require('gulp-debug');
// Default task set.
gulp.task('default', ['docs', 'javascript', 'less']);
/*
* Watch for changes.
*/
gulp.task('watch', function() {
gulp.watch('source/ts/**/*.ts', ['docs', 'javascript']);
gulp.watch('source/less/*.less', ['less']);
});
/*
* Compile API docs from typescript.
*/
gulp.task('docs', ['typescript'], function(cb) {
child_process.exec("typedoc --mode file --out ./docs --module commonjs --target es5 --name Poster ./source/ts/", cb);
});
/*
* Transpile typescript to javascript.
*/
gulp.task('typescript', [], function() {
var tsResult = gulp.src('./source/ts/**/*.ts')
.pipe(ts({
declarationFiles: true,
noExternalResolve: false,
target: 'ES5',
module: 'commonjs',
}));
return merge([
tsResult
.dts
.pipe(gulp.dest('./tmp')),
tsResult
.js
.pipe(gulp.dest('./tmp'))]);
});
/*
* Browserify
*/
gulp.task('javascript', ['typescript'], function() {
gulp.src('tmp/poster.js')
.pipe(browserify({
insertGlobals : true,
}))
.pipe(gulp.dest('./build'));
});
/*
* Compile less to css
*/
gulp.task('less', function() {
gulp.src('source/less/poster.less')
.pipe(less())
.pipe(gulp.dest('./build/'));
});