-
Notifications
You must be signed in to change notification settings - Fork 150
/
gulpfile.js
64 lines (57 loc) · 1.69 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify-es').default;
var paths = {
core: 'src/core.js',
polyfill: 'polyfills/custom-elements.min.js',
plugins: {
attributes: {
src: ['plugins/attributes/src/main.js']
},
events: {
tap: ['plugins/events/tap/pep.min.js', 'plugins/events/tap/main.js']
},
rendering: {
hyperHTML: ['plugins/rendering/hyperHTML/hyperHTML.min.js', 'plugins/rendering/hyperHTML/main.js']
}
}
};
gulp.task('raw', function() {
return gulp.src(paths.core)
.pipe(concat('x-tag-raw.js'))
.pipe(gulp.dest('dist/'));
});
gulp.task('raw.min', function() {
return gulp.src(paths.core)
.pipe(uglify())
.pipe(concat('x-tag-raw.min.js'))
.pipe(gulp.dest('dist/'));
});
gulp.task('polyfilled', function() {
return gulp.src([paths.polyfill, paths.core])
.pipe(concat('x-tag-polyfilled.js'))
.pipe(gulp.dest('dist/'));
});
gulp.task('polyfilled.min', function() {
return gulp.src([paths.polyfill, paths.core])
.pipe(uglify())
.pipe(concat('x-tag-polyfilled.min.js'))
.pipe(gulp.dest('dist/'));
});
Object.keys(paths.plugins).forEach(type => {
var tasks = [];
var plugins = paths.plugins[type];
for (let z in plugins) {
tasks.push(type + ':' + z);
gulp.task(type + ':' + z, function() {
return gulp.src(plugins[z])
.pipe(uglify())
.pipe(concat(z + '.js'))
.pipe(gulp.dest('dist/plugins/' + type));
});
}
gulp.task(type, tasks);
});
gulp.task('default', ['raw', 'polyfilled', 'raw.min', 'polyfilled.min']);
gulp.task('plugins', Object.keys(paths.plugins));
gulp.task('all', ['default', 'plugins']);