https://github.com/riptano/docs-ui
The UI and theme for DataStax Docs.
https://github.com/riptano/docs-ui
antora documentation ui-bundle ui-components
Last synced: 3 months ago
JSON representation
The UI and theme for DataStax Docs.
- Host: GitHub
- URL: https://github.com/riptano/docs-ui
- Owner: riptano
- License: mpl-2.0
- Created: 2023-08-31T16:13:18.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-09-16T18:24:37.000Z (3 months ago)
- Last Synced: 2025-09-16T21:25:15.585Z (3 months ago)
- Topics: antora, documentation, ui-bundle, ui-components
- Language: CSS
- Homepage: https://riptano.github.io/docs-ui/
- Size: 7.46 MB
- Stars: 2
- Watchers: 40
- Forks: 0
- Open Issues: 40
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
= DataStax Docs UI
// Variables:
:current-release:
// Settings:
:!example-caption:
:experimental:
:hide-uri-scheme:
:toc: macro
ifdef::env-github[]
:icons: font
:toc-title: Contents
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
:badges:
endif::[]
// Project URLs:
:url-project: https://github.com/riptano/docs-ui
:url-ui-preview: https://d5rxiv0do0q3v.cloudfront.net/docs-ui-drafts/main/index.html
:url-ui-bundle-latest: {url-project}/releases/latest
// :url-ci-pipelines: {url-project}/pipelines
// :img-ci-status: {url-project}/badges/master/pipeline.svg
:url-docs-home: https://github.com/riptano/docs-home
:url-datastax: https://datastax.com
:url-datastax-docs: https://docs.datastax.com
:url-datastax-docs-repo: https://github.com/riptano/datastax-docs-site
:url-coppi: https://coppi.aws.dsinternal.org
:url-docs-preview: http://docs-preview.datastax.com
:url-tailwind-readme: src/css/README.adoc
// External URLs:
:url-antora: https://antora.org
:url-antora-docs: https://docs.antora.org
:url-antora-ui-docs: https://docs.antora.org/antora-ui-default/
:url-antora-default-ui: https://gitlab.com/antora/antora-ui-default
:url-git: https://git-scm.com
:url-git-dl: {url-git}/downloads
:url-gulp: http://gulpjs.com
:url-opendevise: https://opendevise.com
:url-nodejs: https://nodejs.org
:url-nvm: https://github.com/nvm-sh/nvm
:url-nvm-install: {url-nvm}#installing-and-updating
:url-source-maps: https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Use_a_source_map
:url-create-release: https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release
ifdef::badges[]
image:https://img.shields.io/github/v/release/riptano/docs-ui?label=latest%20release&labelColor=%23232324&color=%237724aa["Latest UI bundle release (GitHub)", link={url-ui-bundle-latest}]
image:https://img.shields.io/badge/Preview-%237724aa["Latest UI preview (GitHub Pages)", link={url-ui-preview}]
endif::[]
This project is used to develop and distribute the UI template for {url-datastax-docs}.
It is a fork of the {url-antora-default-ui}[Antora Default UI] that has been customized for our needs.
The repository itself produces a UI bundle that can be applied when generating a static documentation site using {url-antora}[Antora] -- in our case, we apply it when generating {url-datastax-docs-repo}[datastax-docs-site].
The UI bundle contains the HTML templates (layouts, partials, and helpers), CSS, JavaScript, fonts, and (site-wide) images.
As such, it provides both the visual theme and user interactions for the documentation site.
* Latest UI preview: {url-ui-preview}
* Latest UI bundle release: {url-ui-bundle-latest}
toc::[]
[#use-the-ui]
== Use the DataStax Docs UI
To use the DataStax Docs UI with Antora, add the following configuration to your playbook file:
[source,yaml]
----
ui:
bundle:
url: https://github.com/riptano/ui-docs/releases/latest/download/ui-bundle.zip
snapshot: true
----
[NOTE]
====
The `snapshot` flag tells Antora to fetch the UI when the `--fetch` command-line flag is present.
This setting is required because updates to the UI bundle are pushed to the same URL.
If the URL were to be unique, this setting would not be required.
====
Read on to learn how to develop the UI.
== Development quickstart
This section offers a basic tutorial to teach you how to set up the UI project, preview it locally, and bundle it for use with Antora.
A more comprehensive tutorial can be found in the documentation at {url-antora-ui-docs}.
[#prerequisites]
=== Prerequisites
To preview and bundle the UI, you need the following software on your computer:
* {url-git}[git] (command: `git`)
* {url-nodejs}[Node.js] (commands: `node` and `npm`)
* {url-gulp}[Gulp CLI] (command: `gulp`)
==== git
First, make sure you have git installed.
[source,shell]
----
git --version
----
If not, {url-git-dl}[download and install] the git package for your system.
==== Node.js
Next, make sure that you have Node.js installed (which also provides npm).
[source,shell]
----
node --version
----
If this command fails with an error, you don't have Node.js installed.
If the command doesn't report an https://nodejs.org/en[LTS version] of Node.js, it means you don't have a suitable version of Node.js installed.
While you can install Node.js from the official packages, we strongly recommend that you use {url-nvm}[nvm] (Node Version Manager) to manage your Node.js installation(s).
Follow the {url-nvm-install}[nvm installation instructions] to set up nvm on your machine.
Once you've installed nvm, open a new terminal and install Node.js LTS using the following command:
[source,shell]
----
nvm install --lts
----
You can switch to this version of Node.js at any time using the following command:
[source,shell]
----
nvm use --lts
----
To make Node.js LTS the default in new terminals, type:
[source,shell]
----
nvm alias default node
----
Now that you have Node.js installed, you can proceed with installing the Gulp CLI.
==== Gulp CLI
You'll need the Gulp command-line interface (CLI) to run the build.
The Gulp CLI package provides the `gulp` command which, in turn, executes the version of Gulp declared by the project.
You can install the Gulp CLI globally (which resolves to a location in your user directory if you're using nvm) using the following command:
[source,shell]
----
npm install -g gulp-cli
----
Verify the Gulp CLI is installed and on your PATH by running:
[source,shell]
----
gulp --version
----
If you prefer to install global packages using Yarn, run this command instead:
[source,shell]
----
yarn global add gulp-cli
----
Alternately, you can use the `gulp` command that is installed by the project's dependencies.
[source,shell]
----
npx --offline gulp --version
----
Now that you have the prerequisites installed, you can fetch and build the UI project.
=== Clone and initialize the UI project
Clone the default UI project using git:
[source,shell,subs=attributes+]
----
git clone {url-project} &&
cd "`basename $_`"
----
The example above clones the DataStax Docs UI project and then switches to the project folder on your filesystem.
Stay in this project folder when executing all subsequent commands.
Use npm to install the project's dependencies inside the project.
In your terminal, execute the following command:
[source,shell]
----
npm install
----
This command installs the dependencies listed in [.path]_package.json_ into the [.path]_node_modules/_ folder inside the project.
This folder does not get included in the UI bundle and should _not_ be committed to the source control repository.
[TIP]
====
If you prefer to install packages using Yarn, run this command instead:
[source,shell]
----
yarn
----
====
=== Preview the UI
The default UI project is configured to preview offline.
The files in the [.path]_preview-src/_ folder provide the sample content that allow you to see the UI in action.
In this folder, you'll primarily find pages written in AsciiDoc.
These pages provide a representative sample and kitchen sink of content from the real site.
To build the UI and preview it in a local web server, run the `preview` command:
[source,shell]
----
gulp preview
----
You'll see a URL listed in the output of this command:
....
[12:00:00] Starting server...
[12:00:00] Server started http://localhost:5252
[12:00:00] Running server
....
Navigate to this URL to preview the site locally.
While this command is running, any changes you make to the source files will be instantly reflected in the browser.
This works by monitoring the project for changes, running the `preview:build` task if a change is detected, and sending the updates to the browser.
Press kbd:[Ctrl+C] to stop the preview server and end the continuous build.
[NOTE]
====
Opening or updating a pull request against the `main` branch triggers an automatic `gulp preview` deployment to GitHub Pages so that reviewers can view your latest changes without having to run the preview locally.
====
[#create-bundle]
=== Package for use with Antora
If you need to package the UI so you can use it to generate the documentation site locally, run the following command:
[source,shell]
----
gulp bundle
----
If any errors are reported by lint, you'll need to fix them.
When the command completes successfully, the UI bundle will be available at [.path]_build/ui-bundle.zip_.
You can point Antora at the local path to this bundle using the `--ui-bundle-url` command-line option or the https://docs.antora.org/antora/latest/playbook/ui-bundle-url/#url-key[`ui.bundle.url`] key in the site playbook.
If you have the preview running, and you want to bundle without causing the preview to be clobbered, use:
[source,shell]
----
gulp bundle:pack
----
The UI bundle will again be available at [.path]_build/ui-bundle.zip_.
[NOTE]
====
UI bundles for the DataStax documentation site are automatically published via automation.
See <>.
====
==== Source maps
The build consolidates all the CSS and client-side JavaScript into combined files, [.path]_site.css_ and [.path]_site.js_, respectively, in order to reduce the size of the bundle.
{url-source-maps}[Source maps] correlate these combined files with their original sources.
This "`source mapping`" is accomplished by generating additional map files that make this association.
These map files sit adjacent to the combined files in the build folder.
The mapping they provide allows the debugger to present the original source rather than the obfuscated file, an essential tool for debugging.
In preview mode, source maps are enabled automatically, so there's nothing you have to do to make use of them.
If you need to include source maps in the bundle, you can do so by setting the `SOURCEMAPS` environment variable to `true` when you run the bundle command:
[source,shell]
----
SOURCEMAPS=true gulp bundle
----
In this case, the bundle will include the source maps, which can be used for debugging your production site.
==== Using TailwindCSS
This project uses TailwindCSS.
To learn more see xref:{url-tailwind-readme}[TailwindCSS README].
[#automatic-ui-release]
== Automatic UI bundle release
Once you're satisfied with the changes you've made to the UI, you'll need to open a pull request to merge your changes into the `main` branch.
Upon merging a pull request into `main`, the following automation occurs:
. A new UI bundle is built using `gulp bundle` (linting also occurs during this step).
. Assuming a successful build, a new tag is applied to the latest commit (incremented from the previous `prod-#` tag).
. A new `prod-#` {url-project}/releases[release] is published with auto-generated release notes and the UI bundle release asset.
[TIP]
====
If you don't want your pull request to trigger an automatic release, e.g. you're only making updates to the README or `preview-src` files, you can skip the automation by including `[no-release]` in the commit message.
====
Once the release is published, you can apply it by updating your Antora playbook to point to the new UI bundle URL.
To apply it to the DataStax documentation site, you'll need to update the playbook in the {url-datastax-docs-repo}[datastax-docs-site] repository.
== Copyright and license
=== Software
Original Copyright (C) 2017-present {url-opendevise}[OpenDevise Inc.] and the {url-antora}[Antora Project].
Modifications and additions Copyright (C) 2023-present {url-datastax}[DataStax Inc.].
Use of this software is granted under the terms of the https://www.mozilla.org/en-US/MPL/2.0/[Mozilla Public License Version 2.0] (MPL-2.0).
See link:LICENSE[] to find the full license text.
=== Branding and design
Copyright (C) {url-datastax}[DataStax Inc.] 2023-present.
All rights reserved.