@lexho111/plainblog 0.5.0 → 0.5.2

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import http from "http";
2
- import crypto from "crypto";
2
+ import crypto from "node:crypto";
3
3
  import fs from "fs";
4
4
  import { URLSearchParams } from "url";
5
5
  import Article from "./Article.js";
@@ -498,6 +498,7 @@ export default class Blog {
498
498
  * @param {string[]} files - Array of css/scss file paths to process.
499
499
  */
500
500
  async processStylesheets(files) {
501
+ console.log("process stylesheets")
501
502
 
502
503
  // Normalize input to array (handles string or array)
503
504
  // "file1.css" --> ["file1.css"]
@@ -541,7 +542,7 @@ export default class Blog {
541
542
 
542
543
  // Compile styles using the standalone script from build-styles.js
543
544
  //this.compiledStyles = await compileStyles(fileData);
544
- this.compiledStyles = fileData; // TODO workaround
545
+ this.compiledStyles = fileData.map((f) => f.content).join("\n");
545
546
 
546
547
  // generate a file
547
548
  const __filename = fileURLToPath(import.meta.url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lexho111/plainblog",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
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",
@@ -1,68 +1,126 @@
1
- body { font-family: Arial; } .grid {
2
- border: 0 solid #000;
3
- display: grid;
4
- gap: 0.25rem;
5
- grid-template-columns: 1fr;
6
- }
7
- .grid article {
8
- border: 0 solid #ccc;
9
- border-radius: 4px;
10
- min-width: 0;
11
- overflow-wrap: break-word;
12
- padding: 0.25rem;
13
- }
14
- .grid article h2 {
15
- color: rgb(53, 53, 53);
16
- margin-bottom: 5px;
17
- }
18
-
19
- .grid article .datetime {
20
- margin: 0;
21
- color: rgb(117, 117, 117);
22
- }
23
-
24
- .grid article p {
25
- margin-top: 10px;
26
- margin-bottom: 0;
27
- }
28
-
29
- article a {
30
- color: rgb(105, 105, 105);
31
- }
32
-
33
- article a:visited {
34
- color: rgb(105, 105, 105);
35
- }
36
-
37
- h1 {
38
- color: #696969;
39
- }
40
- nav a {
41
- color: #3b40c1;
42
- font-size: 20px;
43
- text-decoration: underline;
44
- }
45
- nav a:visited {
46
- color: #3b40c1;
47
- text-decoration-color: #3b40c1;
48
- }
49
-
50
- #wrapper {
51
- max-width: 500px;
52
- width: 100%;
53
- }
54
-
55
- /* Mobile Layout (screens smaller than 1000px) */
56
- @media screen and (max-width: 1000px) {
57
- * {
58
- font-size: 4vw;
59
- }
60
- #wrapper {
61
- max-width: 100%;
62
- width: 100%;
63
- padding: 0 10px; /* Prevents text from touching the edges */
64
- box-sizing: border-box;
65
- }
66
- }
1
+ * {
2
+ margin: 0;
3
+ }
67
4
 
68
- /* source-hash: bcb6644ec5b5c6f9685c9ad6c14ee551a6f908b8a2c372d3294e2d2e80d17fb7 */
5
+ body {
6
+ color: red;
7
+ background-color: orange;
8
+ }
9
+
10
+ h1 {
11
+ font: italic bold 2.5em/2.3em Verdana, sans-serif;
12
+ margin: 0;
13
+ padding: 0;
14
+ letter-spacing: 0.1em;
15
+ }
16
+
17
+ #wrapper {
18
+ max-width: 600px;
19
+ width: 100%;
20
+ }
21
+
22
+ .grid {
23
+ display: grid;
24
+ grid-template-columns: 1fr;
25
+ gap: 0.25rem;
26
+ border: 0px solid lightgray;
27
+ }
28
+ .grid article h2 {
29
+ color: hsl(100, 59%, 53%);
30
+ margin-bottom: 5px;
31
+ }
32
+ .grid article {
33
+ padding: 0.25rem;
34
+ border: 0px solid #ccc;
35
+ border-radius: 4px;
36
+ min-width: 0; /* Allow grid items to shrink */
37
+ overflow-wrap: break-word; /* Break long words */
38
+ }
39
+ .grid article .datetime {
40
+ color: darkgray;
41
+ font-style: italic;
42
+ }
43
+ .grid article p {
44
+ margin-top: 12px;
45
+ margin-bottom: 0;
46
+ }
47
+ .grid article a:link {
48
+ color: hsl(100, 59%, 53%);
49
+ }
50
+ .grid article a:visited {
51
+ color: hsl(100, 59%, 53%);
52
+ text-decoration-color: #fcfcfc;
53
+ }
54
+ .grid article a:hover {
55
+ color: hsl(100, 59%, 53%);
56
+ background-color: #fcfcfc;
57
+ }
58
+ .grid article a:active {
59
+ color: hsl(100, 59%, 53%);
60
+ }
61
+
62
+ h1 {
63
+ color: primary;
64
+ }
65
+
66
+ nav {
67
+ padding: 10px;
68
+ background-color: #fcfcfc;
69
+ }
70
+ nav a {
71
+ text-decoration: underline;
72
+ color: #fcfcfc;
73
+ background-color: hsl(100, 59%, 53%);
74
+ font-size: 20px;
75
+ padding: 5px;
76
+ padding-left: 15px;
77
+ padding-right: 15px;
78
+ border-bottom: 4px solid rgb(104, 104, 104);
79
+ border-right: 4px solid rgb(104, 104, 104);
80
+ }
81
+ nav a:link {
82
+ color: #fcfcfc;
83
+ }
84
+ nav a:visited {
85
+ color: #fcfcfc;
86
+ text-decoration-color: #fcfcfc;
87
+ }
88
+ nav a:hover {
89
+ color: hsl(100, 59%, 53%);
90
+ background-color: #fcfcfc;
91
+ }
92
+ nav a:active {
93
+ color: #fcfcfc;
94
+ }
95
+
96
+ #header {
97
+ background: linear-gradient(#fcfcfc, hsl(235, 22%, 73%));
98
+ height: 200px;
99
+ height: 400px;
100
+ }
101
+ #header h1 {
102
+ color: hsl(100, 59%, 53%);
103
+ margin-left: 10px;
104
+ }
105
+ #header img {
106
+ width: 1290px;
107
+ height: 300px;
108
+ margin-left: 10px;
109
+ }
110
+
111
+ /* Mobile Layout (screens smaller than 1000px) */
112
+ @media screen and (max-width: 1000px) {
113
+ * {
114
+ font-size: 4vw;
115
+ }
116
+ #header h1 {
117
+ font-size: 1em;
118
+ }
119
+ #wrapper {
120
+ max-width: 100%;
121
+ width: 100%;
122
+ padding: 0 10px; /* Prevents text from touching the edges */
123
+ box-sizing: border-box;
124
+ }
125
+ }
126
+ /* source-hash: 477a9b23fb6307399e67090d39d6a5e4c322550f5fcdeddc6ce28e4382038f5d */
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
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["styles-compiled.css","styles.css"],"names":[],"mappings":"AAAA,MAIA,mBAAA,CAHA,YAAA,CAEA,UAAA,CADA,yBAGA,CACA,cAEA,mBAAA,CACA,iBAAA,CACA,WAAA,CACA,wBAAA,CAJA,cAKA,CAEA,GACA,SACA,CAOA,cACA,aAAA,CACA,6BACA,CC1BA,KACA,wBAAA,CACA,iBACA,CAEA,MAEA,aAAA,CACA,cAAA,CAFA,yBAGA,CAEA,UAEA,aAAA,CADA,iBAEA,CAEA,GAEA,cACA,CAEA,EACA,eACA,CAEA,KACA,QACA","file":"styles.min.css","sourcesContent":[".grid {\n display: grid;\n grid-template-columns: 1fr;\n gap: 0.25rem;\n border: 0px solid black;\n}\n.grid article {\n padding: 0.25rem;\n border: 0px solid #ccc;\n border-radius: 4px;\n min-width: 0; /* Allow grid items to shrink */\n overflow-wrap: break-word; /* Break long words */\n}\n\nh1 {\n color: red;\n}\n\nnav a {\n text-decoration: underline;\n color: rgb(59, 64, 193);\n font-size: 20px;\n}\nnav a:visited {\n color: rgb(59, 64, 193);\n text-decoration-color: rgb(59, 64, 193);\n}","body {\n background-color: rgb(253, 253, 253);\n font-family: Arial;\n}\n\nnav a {\n text-decoration: underline;\n color: rgb(59, 64, 193);\n font-size: 20px;\n}\n\n.datetime {\n font-style: italic;\n color: rgb(67, 67, 67);\n}\n\nh2 {\n margin: 0;\n margin-bottom: 5px;\n}\n\np {\n margin-top: 10px;\n}\n\nspan {\n margin: 0;\n}\n"]}