@daz4126/swifty 2.0.0 → 2.1.0
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 +5 -5
- package/package.json +1 -1
- package/src/init.js +8 -0
- package/src/layout.js +1 -1
- package/src/pages.js +2 -2
package/README.md
CHANGED
|
@@ -11,10 +11,10 @@ It also uses convention over configuration to make is super simple to build site
|
|
|
11
11
|
## Quickstart
|
|
12
12
|
|
|
13
13
|
1. `npm install @daz4126/swifty`
|
|
14
|
-
2. `npx swifty init`
|
|
14
|
+
2. `npx swifty init` to create a new site
|
|
15
|
+
3. Edit the `template.html` file to match your default layout
|
|
16
|
+
4. Change the `sitename` in `config.yaml`
|
|
17
|
+
5. Add some markdown files to the 'pages' directory
|
|
15
18
|
3. `npx swifty build` to build the site
|
|
16
|
-
|
|
17
|
-
5. Change the `sitename` in `config.yaml`
|
|
18
|
-
6. Add some markdown files to the 'pages' directory
|
|
19
|
-
7. `npx swifty start` to rebuild and start the server
|
|
19
|
+
7. `npx swifty start` to start the server
|
|
20
20
|
8. Visit [http://localhost:3000](http://localhost:3000) to see your site
|
package/package.json
CHANGED
package/src/init.js
CHANGED
|
@@ -22,6 +22,8 @@ breadcrumb_separator: "»"
|
|
|
22
22
|
breadcrumb_class: swifty_breadcrumb
|
|
23
23
|
link_class: swifty_link
|
|
24
24
|
tag_class: tag
|
|
25
|
+
default_layout_name: site
|
|
26
|
+
default_link_name: links
|
|
25
27
|
max_image_size: 800
|
|
26
28
|
|
|
27
29
|
dateFormat:
|
|
@@ -34,6 +36,12 @@ dateFormat:
|
|
|
34
36
|
<head>
|
|
35
37
|
<meta charset="UTF-8">
|
|
36
38
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
39
|
+
<link rel="icon" href="favicon.ico" sizes="48x48" type="image/x-icon">
|
|
40
|
+
<link rel="icon" href="favicon-16x16.png" sizes="16x16" type="image/x-icon">
|
|
41
|
+
<link rel="icon" href="favicon-32x32.png" sizes="32x32" type="image/png">
|
|
42
|
+
<link rel="apple-touch-icon" href="path/to/apple-touch-icon.png">
|
|
43
|
+
<link rel="icon" sizes="192x192" href="android-chrome-192x19.png">
|
|
44
|
+
<link rel="icon" sizes="512x512" href="android-chrome-512x512.png">
|
|
37
45
|
<title>{{sitename}}</title>
|
|
38
46
|
</head>
|
|
39
47
|
<body>
|
package/src/layout.js
CHANGED
|
@@ -28,7 +28,7 @@ const createTemplate = async () => {
|
|
|
28
28
|
const js = await getJsImports();
|
|
29
29
|
const imports = css + js;
|
|
30
30
|
const highlightCSS = `<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/monokai-sublime.min.css">`;
|
|
31
|
-
const template = templateContent.replace('</head>', `${
|
|
31
|
+
const template = templateContent.replace('</head>', `${turboScript}\n${highlightCSS}\n${imports}\n</head>`);
|
|
32
32
|
return template;
|
|
33
33
|
};
|
|
34
34
|
|
package/src/pages.js
CHANGED
|
@@ -47,7 +47,7 @@ const generatePages = async (sourceDir, baseDir = sourceDir, parent) => {
|
|
|
47
47
|
const stats = await fs.stat(filePath);
|
|
48
48
|
const isDirectory = file.isDirectory();
|
|
49
49
|
const layoutFileExists = parent && await fsExtra.pathExists(`${dirs.layouts}/${parent.filename}.html`);
|
|
50
|
-
const layout = layoutFileExists ? parent.filename : parent ? parent.layout :
|
|
50
|
+
const layout = layoutFileExists ? parent.filename : parent ? parent.layout : config.default_layout_name;
|
|
51
51
|
|
|
52
52
|
const page = {
|
|
53
53
|
name, root, layout, filePath,
|
|
@@ -152,7 +152,7 @@ const generatePages = async (sourceDir, baseDir = sourceDir, parent) => {
|
|
|
152
152
|
const generateLinkList = async (name,pages) => {
|
|
153
153
|
const partial = `${name}.md`;
|
|
154
154
|
const partialPath = path.join(dirs.partials, partial);
|
|
155
|
-
const linksPath = path.join(dirs.partials,
|
|
155
|
+
const linksPath = path.join(dirs.partials, defaultConfig.default_link_name);
|
|
156
156
|
// Check if either file exists in the 'partials' folder
|
|
157
157
|
const fileExists = await fsExtra.pathExists(partialPath);
|
|
158
158
|
const defaultExists = await fsExtra.pathExists(linksPath);
|