-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
50 lines (45 loc) · 1.39 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
const gulp = require('gulp');
const inline = require('gulp-inline');
const uglify = require('gulp-uglify');
const minifyCss = require('gulp-clean-css');
const autoprefixer = require('gulp-autoprefixer');
const rename = require("gulp-rename");
const zip = require('gulp-zip');
const clean = require('gulp-clean');
const package = require('./package.json');
gulp.task('inline', function() {
return gulp.src('./build/index.html')
.pipe(inline({
base: './build/',
js: function() {
return uglify({
mangle: false
});
},
css: [minifyCss({level: {1: {specialComments: 0}}}), autoprefixer],
}))
.pipe(gulp.dest('./release')
);
});
gulp.task('rename', function() {
return gulp.src("./release/index.html", { base: process.cwd() })
.pipe(rename({
dirname: "",
basename: `City_ID_Finder_${package.version}`,
extname: ".html"
}))
.pipe(gulp.dest("./release"));
});
gulp.task('zip', function() {
return gulp.src(`./release/City_ID_Finder_${package.version}.html`)
.pipe(zip('City_ID_Finder.zip'))
.pipe(gulp.dest('./release'))
}
);
gulp.task('delete', function() {
return gulp.src('./release/*.html', {read: false})
.pipe(clean())
});
gulp.task('default', gulp.series(
'inline', 'rename', 'zip', 'delete'
));