-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathGulpfile.babel.js
38 lines (32 loc) · 1.05 KB
/
Gulpfile.babel.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
/*eslint-disable*/
var gulp = require('gulp');
var jspm = require('jspm');
var BrowserSync = require('browser-sync');
var replace = require('gulp-replace');
var browserSync = BrowserSync.create();
var dist = './dist';
gulp.task('jspm-bundle', function(done) {
jspm.setPackagePath('.');
jspm.bundleSFX('src/index', dist+'/main.js', {
sourceMaps: false,
minify: true,
mangle: true
}).then(() => {
done();
});
});
gulp.task('html-build', function() {
gulp.src('index.html')
.pipe(replace('<script type="text/javascript" src="jspm_packages/system.js"></script>', ''))
.pipe(replace('<script type="text/javascript" src="config.js"></script>', ''))
.pipe(replace('<script>System.import("src/index.js");</script>', '<script type="text/javascript" src="main.js"></script>'))
.pipe(gulp.dest(dist));
});
gulp.task('serve', function() {
browserSync.init({
server: './',
});
gulp.watch(['*.html', '*.css', 'app/**/*.js']
, browserSync.reload);
});
gulp.task('build', ['jspm-bundle', 'html-build']);