@lexho111/plainblog 0.5.0 → 0.5.1
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 -1
- package/package.json +1 -2
- package/build-styles.js +0 -71
package/Blog.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexho111/plainblog",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "A tool for creating and serving a minimalist, single-page blog.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"autoprefixer": "^10.4.23",
|
|
21
21
|
"child_process": "^1.0.2",
|
|
22
|
-
"crypto": "^1.0.1",
|
|
23
22
|
"fs": "^0.0.1-security",
|
|
24
23
|
"http": "^0.0.1-security",
|
|
25
24
|
"path": "^0.12.7",
|
package/build-styles.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { pathToFileURL } from "url";
|
|
3
|
-
import * as sass from "sass";
|
|
4
|
-
import postcss from "postcss";
|
|
5
|
-
import autoprefixer from "autoprefixer";
|
|
6
|
-
//import cssnano from "cssnano";
|
|
7
|
-
|
|
8
|
-
// array of files or a single file
|
|
9
|
-
export async function compileStyles(fileData) {
|
|
10
|
-
try {
|
|
11
|
-
let combinedCss = "";
|
|
12
|
-
|
|
13
|
-
if (fileData) {
|
|
14
|
-
const scssFiles = fileData.filter(
|
|
15
|
-
(f) =>
|
|
16
|
-
f.path.endsWith(".scss") && !path.basename(f.path).startsWith("_")
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
for (const file of scssFiles) {
|
|
20
|
-
try {
|
|
21
|
-
const result = sass.compileString(file.content.toString(), {
|
|
22
|
-
style: "expanded",
|
|
23
|
-
url: pathToFileURL(file.path),
|
|
24
|
-
});
|
|
25
|
-
combinedCss += result.css + "\n";
|
|
26
|
-
} catch (err) {
|
|
27
|
-
console.error(
|
|
28
|
-
`Error compiling ${path.basename(file.path)}:`,
|
|
29
|
-
err.message
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const cssFiles = fileData.filter((f) => f.path.endsWith(".css"));
|
|
35
|
-
for (const file of cssFiles) {
|
|
36
|
-
combinedCss += file.content + "\n";
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// 2. PostCSS (Autoprefixer + CSSNano)
|
|
41
|
-
if (combinedCss) {
|
|
42
|
-
const plugins = [autoprefixer()];
|
|
43
|
-
const result = await postcss(plugins).process(combinedCss, {
|
|
44
|
-
from: undefined,
|
|
45
|
-
});
|
|
46
|
-
return result.css;
|
|
47
|
-
}
|
|
48
|
-
return "";
|
|
49
|
-
} catch (error) {
|
|
50
|
-
console.error("Build failed:", error);
|
|
51
|
-
return "";
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export async function mergeStyles(...cssContents) {
|
|
56
|
-
try {
|
|
57
|
-
const combinedCss = cssContents.join("\n");
|
|
58
|
-
|
|
59
|
-
if (combinedCss) {
|
|
60
|
-
const plugins = [autoprefixer()];
|
|
61
|
-
const result = await postcss(plugins).process(combinedCss, {
|
|
62
|
-
from: undefined,
|
|
63
|
-
});
|
|
64
|
-
return result.css;
|
|
65
|
-
}
|
|
66
|
-
return "";
|
|
67
|
-
} catch (error) {
|
|
68
|
-
console.error("Merge failed:", error);
|
|
69
|
-
return "";
|
|
70
|
-
}
|
|
71
|
-
}
|