-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·80 lines (64 loc) · 1.9 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 sourcemap = require('gulp-concat-sourcemap');
var uglify = require('gulp-uglifyjs');
var mocha = require('gulp-mocha');
var plumber = require('gulp-plumber');
var debug = require('gulp-debug');
var browserify = require('gulp-browserify');
var path = require('path');
gulp.task('default', ['templates']);
gulp.task('templates', ['concat', 'minify', 'test', 'watch']);
gulp.task('concat', function() {
gulp.src([
'sources/open.js',
'sources/compiler/index.js',
'sources/helpers.js',
'sources/render/index.js',
'sources/sync/index.js',
'sources/async/index.js',
'sources/prototype/index.js',
'sources/renderer/index.js',
'sources/data/index.js',
'sources/tag/index.js',
'sources/single/index.js',
'sources/singles/index.js',
'sources/double/index.js',
'sources/doubles/index.js',
'sources/doctype/index.js',
'sources/doctypes/index.js',
'sources/xml/index.js',
'sources/mixin/index.js',
'sources/mixins/index.js',
'sources/module/index.js',
'sources/with/index.js',
'sources/close.js'
])
.pipe(debug({ title: 'concat:' }))
.pipe(plumber())
.pipe(sourcemap('oswst.js'))
.pipe(gulp.dest('./'));
});
gulp.task('minify', function() {
gulp.src('oswst.js')
.pipe(debug({ title: 'minify:' }))
.pipe(plumber())
.pipe(concat('oswst.min.js'))
.pipe(uglify({ outSourceMap: true, inSourceMap: 'oswst.js.map' }))
.pipe(gulp.dest('./'));
});
gulp.task('test', function() {
gulp.src('tests/server/test.js')
.pipe(browserify({
ignore: [
path.join(__dirname, 'sources/compiler/test.js'),
path.join(__dirname, 'sources/cli/test.js')
]
}))
.pipe(gulp.dest('tests/client/'));
});
gulp.task('watch', function() {
gulp.watch(['sources/*.js', 'sources/**/*.js'], ['concat', 'minify']);
gulp.watch(['tests/server/*', 'sources/**/test.js'], ['test']);
});
process.stdin.on("data", process.exit);