From f0b270b9bcf03cdfc6df10a49ae4c4fccc82827c Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Sat, 3 Oct 2020 08:46:13 -0700 Subject: [PATCH] docs: prerender for gh pages --- docs/_config.yml | 6 ++++++ docs/package.json | 2 +- docs/scripts/postbuild.js | 7 +------ docs/src/App.svelte | 4 +++- docs/src/components/Preview.svelte | 2 +- docs/src/pages/_layout.svelte | 3 +-- 6 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 docs/_config.yml diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 00000000..5f054c82 --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1,6 @@ +include: + - _.js + - _*.js + - assets + - assets/*_.js + - assets/*.js diff --git a/docs/package.json b/docs/package.json index b2b9cb42..366431e2 100644 --- a/docs/package.json +++ b/docs/package.json @@ -6,7 +6,7 @@ "dev:svite": "svite", "build": "run-s build:*", "build:routify": "routify run -b", - "build:svite": "svite build --assetsDir=assets", + "build:svite": "svite build --base=/carbon-components-svelte --assetsDir=assets", "postbuild": "node scripts/postbuild", "deploy": "npx gh-pages -d dist" }, diff --git a/docs/scripts/postbuild.js b/docs/scripts/postbuild.js index b496b7f0..3f3a73bf 100644 --- a/docs/scripts/postbuild.js +++ b/docs/scripts/postbuild.js @@ -19,12 +19,7 @@ async function scrape(page, url = "") { function relativePaths(depth = 0) { const asset_extension = new RegExp(/.(js|css|ico)$/); - let relative_path = - depth > 0 - ? Array.from({ length: depth }, (_, i) => "../") - .join("") - .slice(0, -1) - : "."; + let relative_path = ""; return (tree) => { tree.match( diff --git a/docs/src/App.svelte b/docs/src/App.svelte index 40bf738e..49e5cf73 100644 --- a/docs/src/App.svelte +++ b/docs/src/App.svelte @@ -1,6 +1,8 @@