This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
executable file
·97 lines (80 loc) · 2.56 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
var gulp = require('gulp');
var ghPages = require('gulp-gh-pages');
var gulpif = require('gulp-if');
var vulcanize = require('gulp-vulcanize');
var crisper = require('gulp-crisper');
var babel = require('gulp-babel');
var uglify = require('gulp-uglify');
var runSequence = require('run-sequence');
var del = require('del');
var inline = require('gulp-inline');
gulp.task('deploy', function() {
return gulp.src(['./gh_pages/*/**','./gh_pages/*'])
.pipe(ghPages());
});
gulp.task('cp', function() {
return gulp.src('./index.html')
.pipe(gulp.dest('./gh_pages'));
});
// copy component files to tmp folder
gulp.task('html', function() {
return gulp.src('./es6/*.html')
.pipe(gulpif('*.html', crisper({ scriptInHead:false }))) // Extract JS from .html files
.pipe(gulpif('*.js', babel({ presets: ['es2015'] })))
.pipe(gulp.dest('./tmp/vega-element'));
});
// copy bower dependencies to tmp folder
gulp.task('bower', function() {
return gulp.src('bower_components/*/**')
.pipe(gulp.dest('./tmp/'));
});
gulp.task('vulcanize', function () {
return gulp.src('./tmp/vega-element/index.html')
.pipe(vulcanize({
inlineScripts: true,
inlineCss: true
}))
.pipe(gulp.dest('./gh_pages/'));
});
gulp.task('vulcanize2', function () {
return gulp.src('./tmp/vega-element/vega-element.html')
.pipe(vulcanize({
inlineScripts: true,
inlineCss: true,
}))
.pipe(gulp.dest('./gh_pages/'));
});
gulp.task('vulcanize3', function () {
return gulp.src('./tmp/iron-component-page/iron-component-page.html')
.pipe(vulcanize({
inlineScripts: true,
inlineCss: true,
}))
.pipe(gulp.dest('./gh_pages/'));
});
gulp.task('es5', function () {
return gulp.src('./es6/*.html')
.pipe(gulpif('*.html', crisper({ scriptInHead:false }))) // Extract JS from .html files
.pipe(gulpif('*.js', babel({ presets: ['es2015'] })))
.pipe(gulp.dest('./es5'));
});
gulp.task('build', function () {
return gulp.src('./es5/*.html')
.pipe(inline())
.pipe(gulp.dest('.'));
});
gulp.task('demo', function () {
return gulp.src('./demo/*.*')
.pipe(gulp.dest('./gh_pages/demo'));
});
// Clean output directory
gulp.task('clean', function() {
return del(['./tmp']);
});
// Clean output directory
gulp.task('clean_gh_pages', function() {
return del('./gh_pages/demo','./gh_pages');
});
gulp.task('default', function(cb) {
runSequence(['clean','clean_gh_pages','demo','es5'],['build','html', 'bower'],['vulcanize','vulcanize2'],['clean'],cb);
});