@moonwave99/goffre 0.1.0 → 0.1.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/README.md +32 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,31 +7,31 @@ It uses [handlebars][handlebars] as templating system and [markdown + frontmatte
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
npm install @moonwave99/goffre --save
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Basic Usage
|
|
14
14
|
|
|
15
15
|
```js
|
|
16
|
-
import { load, render } from "goffre";
|
|
16
|
+
import { load, render } from "@moonwave99/goffre";
|
|
17
17
|
|
|
18
18
|
(async () => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
const { pages } = await load();
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
const results = await render({ pages });
|
|
23
|
+
console.log(`Generated ${results.length} pages`);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.log("Error generating site", error);
|
|
26
|
+
}
|
|
27
27
|
})();
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
Default paths:
|
|
31
31
|
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
32
|
+
- **markdown files**: `./data` - used by `load()`
|
|
33
|
+
- **output folder**: `./dist` - used by `render()`
|
|
34
|
+
- **handlebars views**: `./src/views` - used by `render()`
|
|
35
35
|
|
|
36
36
|
See [examples](#examples) for a more advanced use case, and the [documentation][docs] for the complete reference.
|
|
37
37
|
|
|
@@ -66,18 +66,18 @@ The `render()` method writes then every incoming page to `{page.slug}.html` - yo
|
|
|
66
66
|
```js
|
|
67
67
|
const { pages } = await load({ dataPath });
|
|
68
68
|
const results = await render({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
69
|
+
buildPath,
|
|
70
|
+
sitePath,
|
|
71
|
+
pages: [
|
|
72
|
+
...pages,
|
|
73
|
+
{
|
|
74
|
+
title: "Goffre | Mini static site generator",
|
|
75
|
+
description:
|
|
76
|
+
"Goffre is a minimal static site generator available to the node.js ecosystem.",
|
|
77
|
+
slug: "index",
|
|
78
|
+
content: await readFile(path.join("..", "README.md"), "utf8"),
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
81
|
});
|
|
82
82
|
```
|
|
83
83
|
|
|
@@ -97,11 +97,11 @@ The scripts of `package.json` will look more or less like:
|
|
|
97
97
|
|
|
98
98
|
```json
|
|
99
99
|
{
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
"clean": "rm -rf dist",
|
|
101
|
+
"dev:client": "webpack serve --mode development",
|
|
102
|
+
"dev:site": "nodemon -e js,json,md,handlebars --watch index.js --watch data --watch src/views",
|
|
103
|
+
"build:client": "webpack --mode production",
|
|
104
|
+
"build:site": "node index.js"
|
|
105
105
|
}
|
|
106
106
|
```
|
|
107
107
|
|
|
@@ -109,17 +109,15 @@ Just `npm run dev:client` and `npm run dev:site` in two terminal tabs and you ar
|
|
|
109
109
|
|
|
110
110
|
## Examples
|
|
111
111
|
|
|
112
|
-
-
|
|
113
|
-
-
|
|
112
|
+
- [devblog][examples-devblog] - a personal website with blog posts and project pages
|
|
113
|
+
- this page of course
|
|
114
114
|
|
|
115
115
|
[handlebars]: https://handlebarsjs.com/
|
|
116
|
-
[express-handlebars]: https://www.npmjs.com/package/express-handlebars
|
|
117
116
|
[mdfront]: https://www.google.com/search?q=markdown+frontmatter
|
|
118
117
|
[webpack]: https://webpack.js.org/
|
|
119
118
|
[webpack-dev-server]: https://webpack.js.org/configuration/dev-server/
|
|
120
119
|
[http-server]: https://www.npmjs.com/package/http-server
|
|
121
120
|
[nodemon]: https://www.npmjs.com/package/nodemon
|
|
122
|
-
[example]: https://github.com/moonwave99/goffre/tree/main/examples/devblog
|
|
123
121
|
[docs]: https://github.com/moonwave99/goffre/tree/main/examples/devblog
|
|
124
122
|
[webpack-config]: https://github.com/moonwave99/goffre/blob/main/homepage/webpack.config.cjs
|
|
125
123
|
[examples-devblog]: https://goffre-examples-devblog.netlify.app/
|