Skip to content

Commit 4d4d21b

Browse files
author
Duncan Rance
committed
an icon PNG can be configured
1 parent 69ea604 commit 4d4d21b

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

cli/gatsby.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict'
2-
const { statSync, writeFileSync, readFileSync } = require('node:fs')
2+
const { statSync, writeFileSync, readFileSync, copyFileSync } = require('node:fs')
33
const { join, extname } = require('node:path')
44
const { execFileSync } = require('node:child_process')
55
const { Database } = require('arangojs')
@@ -92,6 +92,7 @@ exports.handler = async function (argv) {
9292
log.info(`extracting to ${argv.directory}`)
9393

9494
await copyTemplates(argv.directory, argv.sitecustom)
95+
copyIcon(argv.directory, argv.sitecustom)
9596
await extractNuggets(db, argv.directory, root)
9697
await generateMineMap(db, argv.directory, argv.m, catalog.getFilters())
9798
if (argv.build) buildSite(argv.directory)
@@ -132,6 +133,14 @@ async function copyTemplates (dir, customizations) {
132133
await ncpp(templateDir, dir, options)
133134
}
134135

136+
function copyIcon (dir, customizations) {
137+
// user can specify an icon with path reletive to package.json
138+
if ('icon' in customizations) {
139+
// errors are caught and logged outside
140+
copyFileSync(customizations.icon, join(dir, 'src', 'images', 'icon.png'))
141+
}
142+
}
143+
135144
async function extractNuggets (db, dir, root) {
136145
const contentDir = join(dir, 'content')
137146
const nuggetStash = {}

examples/my-mine/cust-dev.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"color_top_bg": "#F1489E",
1212
"color_top_fg": "#E9E6E7",
1313
"color_side_bg": "#FFDBED",
14-
"color_side_fg": "#4A1D34"
14+
"color_side_fg": "#4A1D34",
15+
"icon": "examples/my-mine/letter-m.png"
1516
}
1617

examples/my-mine/cust-prod.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"color_top_bg": "#F1489E",
1212
"color_top_fg": "#E9E6E7",
1313
"color_side_bg": "#FFDBED",
14-
"color_side_fg": "#4A1D34"
14+
"color_side_fg": "#4A1D34",
15+
"icon": "examples/my-mine/letter-m.png"
1516
}
1617

examples/my-mine/my-mine.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ fs_layout: '1.1'
66
# My Mine
77

88
This is an example rakosh mine
9+
10+
---
11+
12+
[Icon created by yukyik - Flaticon](https://www.flaticon.com/free-icons/alphabet)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rakosh",
3-
"version": "0.10.2",
3+
"version": "0.10.3",
44
"description": "yet another knowledge base system -- this time with nuggets",
55
"author": "Duncan Rance",
66
"license": "MIT",

0 commit comments

Comments
 (0)