@lexho111/plainblog 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Blog.js +1 -50
- package/package.json +1 -1
- package/styles.min.css +2 -2
package/Blog.js
CHANGED
|
@@ -499,7 +499,7 @@ export default class Blog {
|
|
|
499
499
|
const styleFiles = files.filter(
|
|
500
500
|
(f) => (f.endsWith(".scss") || f.endsWith(".css")) && !f.endsWith(".min.css")
|
|
501
501
|
);
|
|
502
|
-
const scriptFiles = files.filter((f) => f.endsWith(".js") && !f.endsWith(".min.js"));
|
|
502
|
+
//const scriptFiles = files.filter((f) => f.endsWith(".js") && !f.endsWith(".min.js"));
|
|
503
503
|
|
|
504
504
|
// --- Process Styles ---
|
|
505
505
|
if (styleFiles.length > 0) {
|
|
@@ -545,55 +545,6 @@ export default class Blog {
|
|
|
545
545
|
console.log("styles are up-to-date")
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
-
|
|
549
|
-
// --- Process Scripts ---
|
|
550
|
-
if (scriptFiles.length > 0) {
|
|
551
|
-
const fileData = await Promise.all(
|
|
552
|
-
scriptFiles.sort().map(async (f) => {
|
|
553
|
-
const content = await fs.promises.readFile(f);
|
|
554
|
-
return { path: f, content };
|
|
555
|
-
})
|
|
556
|
-
);
|
|
557
|
-
|
|
558
|
-
const currentHash = crypto
|
|
559
|
-
.createHash("sha256")
|
|
560
|
-
.update(
|
|
561
|
-
fileData
|
|
562
|
-
.map((f) =>
|
|
563
|
-
crypto.createHash("sha256").update(f.content).digest("hex")
|
|
564
|
-
)
|
|
565
|
-
.join("")
|
|
566
|
-
)
|
|
567
|
-
.digest("hex");
|
|
568
|
-
|
|
569
|
-
if (currentHash !== this.#scriptsHash) {
|
|
570
|
-
console.log("Script assets have changed. Recompiling...");
|
|
571
|
-
this.#scriptsHash = currentHash;
|
|
572
|
-
|
|
573
|
-
const vinyls = fileData.map(
|
|
574
|
-
(f) =>
|
|
575
|
-
new Vinyl({
|
|
576
|
-
cwd: process.cwd(),
|
|
577
|
-
base: path.dirname(f.path),
|
|
578
|
-
path: f.path,
|
|
579
|
-
contents: f.content,
|
|
580
|
-
})
|
|
581
|
-
);
|
|
582
|
-
fileData.map(
|
|
583
|
-
(f) => {
|
|
584
|
-
console.log(`${f.path} ${f.content}`)})
|
|
585
|
-
|
|
586
|
-
const stream = Readable.from(vinyls);
|
|
587
|
-
const outputStream = compileScripts(stream);
|
|
588
|
-
this.compiledScripts = await this.#streamToString(outputStream);
|
|
589
|
-
await fs.promises.writeFile(
|
|
590
|
-
path.join(__dirname, "scripts.min.js"),
|
|
591
|
-
this.compiledScripts + `\n/* source-hash: ${currentHash} */`
|
|
592
|
-
);
|
|
593
|
-
} else {
|
|
594
|
-
console.log("scripts are up-to-date")
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
548
|
}
|
|
598
549
|
|
|
599
550
|
#streamToString(stream) {
|
package/package.json
CHANGED
package/styles.min.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.grid{border:0 solid #000;display:grid;gap:.25rem;grid-template-columns:1fr}.grid article{border:0 solid #ccc;border-radius:4px;min-width:0;overflow-wrap:break-word;padding:.25rem}
|
|
2
|
-
|
|
1
|
+
.grid{border:0 solid #000;display:grid;gap:.25rem;grid-template-columns:1fr}.grid article{border:0 solid #ccc;border-radius:4px;min-width:0;overflow-wrap:break-word;padding:.25rem}h1{color:#7f0000}nav a{color:#3b40c1;font-size:20px;text-decoration:underline}nav a:visited{color:#3b40c1;text-decoration-color:#3b40c1}
|
|
2
|
+
/* source-hash: 91ab1d754238759404d2b8becfe52372f6f7b9c0f136b8b125c69faadeacd9d7 */
|