2024-06-20 10:00:58 +00:00
|
|
|
import fs from "fs";
|
|
|
|
|
import gulp from "gulp";
|
2025-04-06 20:13:13 +00:00
|
|
|
import path from "path/posix";
|
2024-06-20 10:00:58 +00:00
|
|
|
import { buildFolder } from "./config.js";
|
|
|
|
|
|
|
|
|
|
import gulpDom from "gulp-dom";
|
|
|
|
|
import gulpHtmlmin from "gulp-htmlmin";
|
|
|
|
|
import gulpRename from "gulp-rename";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* PROVIDES
|
|
|
|
|
*
|
2025-04-06 20:13:13 +00:00
|
|
|
* html
|
2024-06-20 10:00:58 +00:00
|
|
|
*/
|
2025-04-06 20:13:13 +00:00
|
|
|
|
|
|
|
|
async function buildHtml() {
|
2024-06-20 10:00:58 +00:00
|
|
|
return gulp
|
|
|
|
|
.src("../src/html/index.html")
|
|
|
|
|
.pipe(
|
|
|
|
|
gulpDom(
|
|
|
|
|
/** @this {Document} **/ function () {
|
|
|
|
|
const document = this;
|
|
|
|
|
|
2025-04-06 20:13:13 +00:00
|
|
|
let loadingCss = fs.readFileSync(path.join("preloader", "preloader.css")).toString();
|
2024-06-20 10:00:58 +00:00
|
|
|
|
|
|
|
|
const style = document.createElement("style");
|
|
|
|
|
style.textContent = loadingCss;
|
|
|
|
|
document.head.appendChild(style);
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
.pipe(
|
|
|
|
|
gulpHtmlmin({
|
|
|
|
|
caseSensitive: true,
|
|
|
|
|
collapseBooleanAttributes: true,
|
|
|
|
|
collapseInlineTagWhitespace: true,
|
|
|
|
|
collapseWhitespace: true,
|
|
|
|
|
preserveLineBreaks: true,
|
|
|
|
|
minifyJS: true,
|
|
|
|
|
minifyCSS: true,
|
|
|
|
|
quoteCharacter: '"',
|
|
|
|
|
useShortDoctype: true,
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
.pipe(gulpRename("index.html"))
|
|
|
|
|
.pipe(gulp.dest(buildFolder));
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-06 20:13:13 +00:00
|
|
|
export default buildHtml;
|