@terrymooreii/sia 2.0.1 ā 2.0.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/lib/server.js +9 -1
- package/package.json +10 -2
- package/src/pages/about.md +1 -1
package/lib/server.js
CHANGED
|
@@ -64,10 +64,17 @@ function injectLiveReload(html, wsPort) {
|
|
|
64
64
|
* Create the HTTP server
|
|
65
65
|
*/
|
|
66
66
|
function createHttpServer(config, wsPort) {
|
|
67
|
+
const basePath = config.site.basePath || '';
|
|
68
|
+
|
|
67
69
|
const server = createServer((req, res) => {
|
|
68
70
|
// Parse URL
|
|
69
71
|
let urlPath = req.url.split('?')[0];
|
|
70
72
|
|
|
73
|
+
// Strip basePath from the URL if present (for local dev with subpath hosting)
|
|
74
|
+
if (basePath && urlPath.startsWith(basePath)) {
|
|
75
|
+
urlPath = urlPath.slice(basePath.length) || '/';
|
|
76
|
+
}
|
|
77
|
+
|
|
71
78
|
// Handle root and trailing slashes
|
|
72
79
|
if (urlPath.endsWith('/')) {
|
|
73
80
|
urlPath += 'index.html';
|
|
@@ -215,7 +222,8 @@ export async function startServer(options = {}) {
|
|
|
215
222
|
|
|
216
223
|
// Start HTTP server
|
|
217
224
|
httpServer.listen(httpPort, () => {
|
|
218
|
-
|
|
225
|
+
const basePath = config.site.basePath || '';
|
|
226
|
+
console.log(`\nš Server running at http://localhost:${httpPort}${basePath}/`);
|
|
219
227
|
console.log(`š Live reload on ws://localhost:${wsPort}`);
|
|
220
228
|
console.log('\nš Watching for changes...\n');
|
|
221
229
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terrymooreii/sia",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "A simple, powerful static site generator with markdown, front matter, and Nunjucks templates",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -19,7 +19,15 @@
|
|
|
19
19
|
"nunjucks",
|
|
20
20
|
"blog"
|
|
21
21
|
],
|
|
22
|
-
"author": "",
|
|
22
|
+
"author": "Terry Moore II",
|
|
23
|
+
"homepage": "https://github.com/terrymooreii/sia",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/terrymooreii/sia.git"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/terrymooreii/sia/issues"
|
|
30
|
+
},
|
|
23
31
|
"license": "MIT",
|
|
24
32
|
"dependencies": {
|
|
25
33
|
"chalk": "^5.3.0",
|
package/src/pages/about.md
CHANGED