-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
executable file
·34 lines (29 loc) · 1.02 KB
/
build.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
#!/usr/bin/env node
const babel = require('gulp-babel');
const Builder = require('systemjs-builder');
const crisper = require('gulp-crisper');
const gulpif = require('gulp-if');
const htmlprocessor = require('gulp-htmlprocessor');
const rename = require('gulp-rename');
const rimraf = require('rimraf');
const vfs = require('vinyl-fs');
rimraf.sync('build');
const builder = new Builder('public/', 'public/config.js');
builder.buildStatic('main.js', 'build/bundle.js');
vfs.src(['public/**/polymer*.html'])
.pipe(rename(path => { path.dirname = 'lib';})) // eslint-disable-line
.pipe(vfs.dest('build'));
vfs.src(
[
'public/.htaccess',
'public/*.{txt,ico,json}',
'public/style*/**/*'])
.pipe(vfs.dest('build'));
const extractjs = crisper({ scriptInHead: false });
const transpile = babel({ presets: ['es2015'] });
const es5it = gulpif(f => f.extname === '.js', transpile);
vfs.src(['public/*.html', 'public/components*/*.html'])
.pipe(htmlprocessor())
.pipe(extractjs)
.pipe(es5it)
.pipe(vfs.dest('build'));