forked from redpelicans/aurelia-material
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
63 lines (52 loc) · 1.41 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
var gulp = require('gulp');
var del = require('del');
var vinylPaths = require('vinyl-paths');
var babel = require('gulp-babel');
var changed = require('gulp-changed');
var plumber = require('gulp-plumber');
var sourcemaps = require('gulp-sourcemaps');
var runSequence = require('run-sequence');
var path = require('path');
var paths = {
source:'src/**/*.js'
, html:'src/**/*.html'
, dist: 'dist'
, sourceRoot: path.join(__dirname, 'src'),
}
// need this options to use decorators
var compilerOptions = {
stage: 0,
optional: [
"es7.decorators",
"regenerator",
"asyncToGenerator",
"es7.classProperties",
"es7.asyncFunctions"
]
};
gulp.task('build-client', function () {
return gulp.src(paths.source)
.pipe(plumber())
.pipe(changed(paths.dist, {extension: '.js'}))
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(babel(compilerOptions))
.pipe(sourcemaps.write('.', { includeContent: true, sourceRoot: paths.sourceRoot}))
.pipe(gulp.dest(paths.dist));
});
gulp.task('build-html', function () {
return gulp.src(paths.html)
.pipe(changed(paths.dist, {extension: '.html'}))
.pipe(gulp.dest(paths.dist));
});
gulp.task('build', function(callback) {
return runSequence(
'clean',
['build-client', 'build-html'],
callback
);
});
gulp.task('clean', function() {
return gulp.src([paths.dist])
.pipe(vinylPaths(del));
});
gulp.task('default', ['build']);