Skip to content

Commit

Permalink
feat(docs): enable building static site version
Browse files Browse the repository at this point in the history
  • Loading branch information
hydrosquall committed Feb 4, 2024
1 parent b8353d5 commit b8e1063
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/_config-docset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# A "docset" is an offline-friendly version of the documentation page
# It can be served from the filesystem without a live server.

title: Vega
description: SEO not needed for docset
baseurl: "DOCSET_BASE_TO_REPLACE" # the subpath of your site, e.g. /blog
url: "https://vega.github.io" # the base hostname & protocol for your site
is_docset_build: true # if true, will make choices that assume the site is served from the filesystem instead of a webserver

# Build settings
markdown: kramdown
highlighter: rouge

twitter:
username: vega_vis

kramdown:
input: GFM
syntax_highlighter: rouge
auto_id_stripping: true

exclude:
- Gemfile
- Gemfile.lock
5 changes: 5 additions & 0 deletions docs/_includes/embed
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ function image(view, type) {
};
}


var view = new vega.View(vega.parse(spec), {
{% if site.is_docset_build == true %}
loader: vega.loader({baseURL: 'https://vega.github.io/vega/'}),
{% else %}
loader: vega.loader({baseURL: '{{ site.baseurl }}/'}),
{% endif %}
logLevel: vega.Warn,
renderer: '{{ include.renderer | default: "svg" }}'
}).initialize('#{{id}}').hover().run();
Expand Down
2 changes: 2 additions & 0 deletions docs/_layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<link rel="stylesheet" href="{{ site.baseurl }}/assets/syntax.css">
<link rel="stylesheet" href="{{ site.baseurl }}/assets/main.css">
<script src="{{ site.baseurl }}/vega.min.js"></script>
{% if site.is_docset_build != true %}
{% seo %}
{% endif %}
</head>
<body>
<div class="fill">
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"clean": "lerna clean --yes && lerna exec -- rimraf build && lerna exec -- rimraf LICENSE && rimraf node_modules yarn.lock",
"data": "rsync -r node_modules/vega-datasets/data/* docs/data",
"docs": "cd docs && bundle exec jekyll serve -I -l",
"docs:static": "pushd docs && bundle exec jekyll build -c _config-docset.yml && popd",
"docsbuild": "cd packages/vega/build && cp vega.js vega.min.js* vega-core.js vega-core.min.js* vega-schema.json ../../../docs/",
"license": "lerna exec -- cp ../../LICENSE .",
"release": "yarn license && lerna publish from-package",
Expand Down

0 comments on commit b8e1063

Please sign in to comment.