From 32c8a2365555f5f865748ef0990278e6efcadf54 Mon Sep 17 00:00:00 2001 From: Simone Caporale Date: Thu, 12 Nov 2020 15:20:49 +0100 Subject: [PATCH] html: keep the inlined html during build --- html/gulpfile.js | 15 +++++++++++---- html/package.json | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/html/gulpfile.js b/html/gulpfile.js index d3ea1ad..48237c9 100644 --- a/html/gulpfile.js +++ b/html/gulpfile.js @@ -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'); @@ -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); @@ -52,4 +58,5 @@ task('default', () => { })) .pipe(rename("html.h")) .pipe(dest('../src/')); -}); +})); + diff --git a/html/package.json b/html/package.json index 7593fb2..ed21bcc 100644 --- a/html/package.json +++ b/html/package.json @@ -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" }, -- 2.43.4