docs: prerender for gh pages

This commit is contained in:
Eric Liu 2020-10-03 08:46:13 -07:00
commit f0b270b9bc
6 changed files with 13 additions and 11 deletions

6
docs/_config.yml Normal file
View file

@ -0,0 +1,6 @@
include:
- _.js
- _*.js
- assets
- assets/*_.js
- assets/*.js

View file

@ -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"
},

View file

@ -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(

View file

@ -1,6 +1,8 @@
<script>
import { Router } from "@sveltech/routify";
import { Router, basepath } from "@sveltech/routify";
import { routes } from "../.routify/routes";
$basepath = "/carbon-components-svelte";
</script>
<style lang="scss" global>

View file

@ -143,7 +143,7 @@
kind="ghost"
target="_blank"
size="field"
href="{src}"
href="{$url(src)}"
icon="{Launch16}"
>
Open in new tab

View file

@ -164,7 +164,6 @@
<svelte:body
on:mouseover="{async (e) => {
return;
if (process.env.NODE_ENV === 'development') return;
if (!e.target.href || !e.target
.getAttribute('class')
@ -179,7 +178,7 @@
<Theme persist>
<Header
aria-label="Navigation"
href="/"
href="{$url('/')}"
expandedByDefault="{true}"
bind:isSideNavOpen
>