Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var
coverage
*~lock~

# Dependencies
node_modules/
Expand All @@ -22,6 +23,7 @@ npm-debug.log*
# NPM package files
*.tgz


# OS
.DS_Store
Thumbs.db
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Leafstone
# leafstone

<p align="center">
<img src="assets/logo.svg" alt="leafstone icon" width="100">
</p>

[![Test](https://github.com/matthen/leafstone/workflows/Test/badge.svg)](https://github.com/matthen/leafstone/workflows/Test)
[![Lint](https://github.com/matthen/leafstone/workflows/Lint/badge.svg)](https://github.com/matthen/leafstone/workflows/Lint)
Expand Down
Binary file added assets/logo.afdesign
Binary file not shown.
1 change: 1 addition & 0 deletions assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ async function startServer(componentFile, port = 3000, options = {}) {
// Copy assets to temp directory
await copyAssets(assets, tempDir);

// Copy favicon to public directory in temp project
const faviconSrc = path.join(__dirname, '..', 'assets', 'logo.svg');
const faviconDest = path.join(tempDir, 'public', 'favicon.svg');
const publicDir = path.join(tempDir, 'public');

if (!fs.existsSync(publicDir)) {
fs.mkdirSync(publicDir, { recursive: true, mode: 0o755 });
}

if (fs.existsSync(faviconSrc)) {
fs.copyFileSync(faviconSrc, faviconDest);
fs.chmodSync(faviconDest, 0o644);
}

const viteConfig = {
root: tempDir,
plugins: [react()],
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"files": [
"bin/",
"lib/",
"templates/"
"templates/",
"assets/"
],
"scripts": {
"test": "jest",
Expand Down
5 changes: 1 addition & 4 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
content="Interactive demo of {{componentName}} React component built with Leafstone"
/>
<meta name="theme-color" content="#282a36" />
<link
rel="icon"
href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚛️</text></svg>"
/>
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen">
<div id="root"></div>
Expand Down