-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use
vite
to bundle index.html
code
Uses `vite` to bundle the `index.html` code. This has a few benefits: - we can remove our custom `copy_modules.sh` script - our `dist/` folder can be smaller and better optimized - we now support using ESM modules in the client (puppeteer didn't like these before) This is needed since mermaid-mindmap is ESM only.
- Loading branch information
1 parent
bfe3823
commit 9e168fb
Showing
7 changed files
with
432 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
node_modules/ | ||
*.svg | ||
*.png | ||
*.min.js | ||
*.bundle.js | ||
fontawesome/ | ||
/dist | ||
.DS_Store | ||
.npmrc | ||
yarn-error.log | ||
test-positive/*.out.md | ||
test-output/ | ||
|
||
# these are no longer used, but may still be in people's git folders | ||
fontawesome/ | ||
*.min.js | ||
*.bundle.js |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="./fontawesome/css/fa-brands.css"> | ||
<link rel="stylesheet" href="./fontawesome/css/fa-regular.css"> | ||
<link rel="stylesheet" href="./fontawesome/css/fa-solid.css"> | ||
<link rel="stylesheet" href="./fontawesome/css/fontawesome.css"> | ||
</head> | ||
<body> | ||
<div id="container"></div> | ||
<script src="./mermaid.min.js" charset="utf-8"></script> | ||
<script type="module"> | ||
import faBrands from "@fortawesome/fontawesome-free-webfonts/css/fa-brands.css" | ||
import faRegular from "@fortawesome/fontawesome-free-webfonts/css/fa-regular.css" | ||
import faSolid from "@fortawesome/fontawesome-free-webfonts/css/fa-solid.css" | ||
import fontawesome from "@fortawesome/fontawesome-free-webfonts/css/fontawesome.css" | ||
|
||
import mermaid from "mermaid" | ||
|
||
// expose mermaid to the global scope so that puppeteer can see it | ||
globalThis.mermaid = mermaid | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineConfig } from "vite" | ||
import { viteSingleFile } from "vite-plugin-singlefile" | ||
import svgLoader from 'vite-svg-loader' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
// bundle everything into a single `index.html` | ||
viteSingleFile(), | ||
// unsure if this is working properly for fontawesome fonts | ||
svgLoader(), | ||
], | ||
}) |
Oops, something went wrong.