Skip to content

Commit

Permalink
html: keep the inlined html during build
Browse files Browse the repository at this point in the history
  • Loading branch information
Simone Caporale authored and tsl0922 committed Dec 31, 2020
1 parent 3709de4 commit 32c8a23
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
15 changes: 11 additions & 4 deletions html/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { src, dest, task } = require("gulp");
const { src, dest, task, series } = require("gulp");
const clean = require('gulp-clean');
const gzip = require('gulp-gzip');
const inlineSource = require('gulp-inline-source');
Expand Down Expand Up @@ -33,13 +33,19 @@ const genHeader = (size, buf, len) => {
let fileSize = 0;

task('clean', () => {
return src('dist', {read: false, allowEmpty: true})
return src('dist', { read: false, allowEmpty: true })
.pipe(clean());
});

task('default', () => {
task('inline', () => {
return src('dist/index.html')
.pipe(inlineSource())
.pipe(rename("inline.html"))
.pipe(dest('dist/'));
});

task('default', series('inline', () => {
return src('dist/inline.html')
.pipe(through2.obj((file, enc, cb) => {
fileSize = file.contents.length;
return cb(null, file);
Expand All @@ -52,4 +58,5 @@ task('default', () => {
}))
.pipe(rename("html.h"))
.pipe(dest('../src/'));
});
}));

1 change: 1 addition & 0 deletions html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"prestart": "gulp clean",
"start": "webpack serve",
"build": "NODE_ENV=production webpack && gulp",
"inline": "NODE_ENV=production webpack && gulp inline",
"check": "gts check",
"fix": "gts fix"
},
Expand Down

0 comments on commit 32c8a23

Please sign in to comment.