Skip to content

Commit

Permalink
Support Cloud Docs Preview and local build
Browse files Browse the repository at this point in the history
  • Loading branch information
pengchengrun committed Dec 31, 2024
1 parent 8310405 commit e1f71f0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
54 changes: 53 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,56 @@ This repository only contains the source files for the published documentation.
To view the published version, see link:https://docs.tigergraph.com/cloud[TigerGraph Cloud Documentation].

== Contribution
For instructions on how to contribute to this repository, see link:https://github.com/tigergraph/doc-site/blob/main/contribution.adoc[Contribution guidelines].
For instructions on how to contribute to this repository, see link:https://github.com/tigergraph/doc-site/blob/main/contribution.adoc[Contribution guidelines].

== Install dependencies
To install dependencies, navigate to this repository and run:
[,console]
----
npm install
----

== Build site locally
To build the site locally, run:
[,console]
----
npm run build
----
The build will be available in the `build/` folder in the root directory.

IMPORTANT: Though the files are all in the `/build` folder, you won't be able to access other pages through the links if the files are not served by a server.
To preview locally, you can <<Run a local server to view the build>>. If you really don't want to use a local server, edit the `antora-playbook.yml` file in your local environment, and change the `html_extension_style` under `urls` to `default`. This allows you to open the static files and have the links work.

=== Build from your local content source repository
To have Antora build the site from your local content source repository, change the corresponding content source in the file `antora-playbook.yml` to point to your local git repository.

See https://docs.antora.org/antora/2.3/playbook/content-source-url/#local-urls[Use local content repositories] on Antora's documentation.

== Watch Mode

Watch Mode launches a local web server for preview. It will continue watching your local content source repository changes and rebuild the site.

[,console]
----
npm run dev
----

You can access the web server at http://localhost:5000[http://localhost:5000].

== Run a local server to view the build

To open the build, run:
[,console]
----
$ npm i -g http-server
$ http-server build/site -c-1
----
Upon launching the command, the local address of the web server will be displayed in your terminal. You should see the following output in your terminal:

----
Starting up http-server, serving build/site
Available on:
http://127.0.0.1:8080
http://192.168.1.8:8080
Hit CTRL-C to stop the server
----
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "antora generate --fetch antora-playbook.yml",
"dev": "gulp",
"serve": "http-server build/site -c-1"
Expand Down

0 comments on commit e1f71f0

Please sign in to comment.