-
Notifications
You must be signed in to change notification settings - Fork 44
/
gulpfile.js
43 lines (37 loc) · 1.06 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
const gulp = require('gulp');
const postcss = require('gulp-postcss');
const cssnext = require('postcss-cssnext');
const babel = require('gulp-babel');
const through = require('through2');
const htmlMinifier = require('gulp-html-minifier');
const replace = require('gulp-replace');
const pkg = require('./package.json');
gulp.task('build-css', _ =>
gulp.src('app/*.css')
.pipe(postcss([cssnext]))
.pipe(gulp.dest('dist'))
);
gulp.task('build-js', _ =>
gulp.src('app/*.js')
.pipe(replace('{%VERSION%}', pkg.version))
.pipe(babel({
presets: ['babili']
}))
.pipe(gulp.dest('dist'))
);
gulp.task('build-html', _ =>
gulp.src('app/index.html')
.pipe(htmlMinifier({
minifyCSS: true,
minifyJS: false,
removeAttributeQuotes: true,
collapseWhitespace: true,
customAttrCollapse: /^d$/
}))
.pipe(gulp.dest('dist'))
);
gulp.task('copy', _ =>
gulp.src(['app/images/**/*', 'app/manifest.json'], {base: 'app'})
.pipe(gulp.dest('dist'))
)
gulp.task('default', ['build-css', 'build-js', 'build-html', 'copy']);