-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
70 lines (60 loc) · 1.89 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
'use strict';
var gulp = require('gulp');
var del = require('del');
var Builder = require('systemjs-builder');
var traceur = require('gulp-traceur');
var http = require('http');
var connect = require('connect');
var serveStatic = require('serve-static');
var open = require('open');
gulp.task('clean', function (done) {
del(['dev'], done);
});
gulp.task('build:angular2', function () {
var builder = new Builder({
paths: {
'angular2/*': 'node_modules/angular2/es6/dev/*.es6',
rx: 'node_modules/angular2/node_modules/rx/dist/rx.js'
},
meta: {
rx: {
format: 'cjs'
}
}
});
return builder.build('angular2/angular2', './public/lib/angular2.js', {});
});
gulp.task('build:lib', ['build:angular2'], function () {
gulp.src([
'./node_modules/gulp-traceur/node_modules/traceur/bin/traceur-runtime.js',
'./node_modules/gulp-traceur/node_modules/traceur/bin/traceur.js',
'./node_modules/angular2/node_modules/zone.js/dist/zone.js',
'./node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.js',
'./node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.js.map',
'./node_modules/reflect-metadata/Reflect.js',
'./node_modules/reflect-metadata/Reflect.js.map',
'./node_modules/systemjs/dist/system.js',
'./node_modules/systemjs/dist/system.js.map'
])
.pipe(gulp.dest('./public/lib'));
});
gulp.task('build', function () {
return gulp.src('./js/**/*.js')
.pipe(traceur({
sourceMaps: 'inline',
modules: 'instantiate',
annotations: true,
memberVariables: true,
types: true
}))
.pipe(gulp.dest('./dev'));
});
gulp.task('serve', ['build:lib', 'build'], function () {
var port = 5555
var app;
gulp.watch('./js/**', ['build']);
app = connect().use(serveStatic(__dirname));
http.createServer(app).listen(port, function () {
open('http://localhost:' + port);
});
});