Skip to content

Commit

Permalink
Add ReadMe file
Browse files Browse the repository at this point in the history
Based on original instructions from site wiki per #117:
https://github.com/dita-ot/dita-ot.github.io/wiki/Building-site-output

Signed-off-by: Roger Sheen <roger@infotexture.net>
  • Loading branch information
infotexture committed Dec 17, 2018
1 parent fb51af6 commit 445787b
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 0 deletions.
140 changes: 140 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# dita-ot.github.io

This repository contains the source files for the **DITA Open Toolkit** project website at [dita-ot.org][1].

For details and background information on how we build and maintain the site, visit [dita-ot.org/colophon][2].

---

If you'd like to set up a local staging environment and build a copy of the site, follow the instructions below.

<!-- MarkdownTOC autolink="true" bracket="round" levels="2" -->

- [Environment setup](#environment-setup)
- [Install prerequisite software](#install-prerequisite-software)
- [Building site output](#building-site-output)
- [Updating JavaScript](#updating-javascript)
- [Happy staging!](#happy-staging)

<!-- /MarkdownTOC -->

## Environment setup

1. Clone the DITA-OT and project website repositories:

git clone https://github.com/dita-ot/dita-ot.git
git clone https://github.com/dita-ot/dita-ot.github.io.git

**NOTE:** The examples below assume the the DITA-OT and project website repositories have been cloned to a common parent directory, such as your home folder. If you clone the repositories to a different location, substitute that path for the tilde symbol `~` in the samples below.

2. Move to the DITA-OT directory:

cd dita-ot

3. Fetch the submodules:

git submodule update --init --recursive

4. In the root directory, run the Gradle wrapper to compile the Java code and install plugins:

./gradlew

5. Install the HTML plug-in for the DITA-OT project website: `org.dita-ot.html`

src/main/bin/dita --install https://github.com/dita-ot/org.dita-ot.html/archive/master.zip

## Install prerequisite software

1. Install [Jekyll][3]:

gem install jekyll

2. Install [Bundler][4]:

gem install bundler

3. Switch to your clone of the project website repository:

cd ~/dita\-ot\.github\.io

4. Install all of the required gems from the project’s `Gemfile`:

bundle install

5. Run Jekyll.

bundle exec jekyll serve

This runs the production version of the site locally, so you can view your local clone of the project website at [http://127.0.0.1:4000/][5].

At this stage, what you see there should be identical to the production version of the project website at [www.dita-ot.org][1].

**Note:** For more details, see [Setting up your GitHub Pages site locally with Jekyll][6].

## Building site output

1. Switch to the `docsrc` submodule of the local `dita-ot` clone:

cd ~/dita-ot/src/main/docsrc

2. Check out the `develop` branch of the `docs` repository to update the `docsrc` submodule pointer to the latest development state _(or to another branch if you need to generate output for that)_:

git checkout develop

3. Run the `site` build task with the Gradle wrapper to generate the output for the project website:

./gradlew site

The output will be generated by default in `src/main/docsrc/build/site`.

_(This appears as unstyled HTML when viewed in place.)_

To redirect the output to the `dev` development folder that Jekyll serves, pass the `outputDir` parameter to the build script as follows:

./gradlew site -PoutputDir=~/dita-ot.github.io/dev

After the build completes, you should find the results in the **Docs \> Development** section of the local staging environment [http://127.0.0.1:4000/dev/][7].

To automatically regenerate the site output whenever documentation source files change, add the `--continuous` build option:

./gradlew site -PoutputDir=~/dita-ot.github.io/dev --continuous

## Updating JavaScript

If you need to change any of the JavaScript files in the site repository, you'll need to [download & install Node.js][8] and run the `npm` package manager for JavaScript to install the project dependencies:

npm ci

This will install various Node modules including [Gulp][9], the streaming build system.

To run Gulp separately, you may need to install it per <https://gulpjs.com>:

npm install gulp-cli -g
npm install gulp -D

To make changes to the JavaScript code, add or edit source files in the `_js` folder.

You can then run Gulp to minify the modified JavaScript code:

gulp

Or run the `watch-js` task to monitor the JavaScript source files in the `_js` folder for changes, and compile the minified code to the `js` folder whenever the source files change:

gulp watch-js

## Happy staging!

You can now use the local staging environment to test your changes before committing your work.

When you're ready to share your progress, send us a [pull request][10].

[1]: https://www.dita-ot.org
[2]: https://www.dita-ot.org/colophon
[3]: https://jekyllrb.com
[4]: https://bundler.io
[5]: http://127.0.0.1:4000/
[6]: https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/
[7]: http://127.0.0.1:4000/dev/
[8]: https://nodejs.org/en/download/
[9]: https://gulpjs.com
[10]: https://help.github.com/articles/about-pull-requests/
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ exclude:
- LICENSE
- node_modules
- package*.js*
- README.md

# Enable redirects (#43)
plugins:
Expand Down

0 comments on commit 445787b

Please sign in to comment.