Skip to content

Commit

Permalink
Switch to Hugo
Browse files Browse the repository at this point in the history
This commit includes all the needed workarounds and most changes from the main branch for everything to work, like:

* removing empty lines in raw HTML that break output
* read browserslistrc, CSS variables from disk instead of duplicating it
* using Hugo mounts
* using Hugo for the docs CSS/JS

Thus, this patch makes our npm scripts faster since lint runs on one step and there's no separate docs assets processing.

Note, that I had to work around the jQuery file being included in our docs JS bundle.
  • Loading branch information
XhmikosR committed Nov 9, 2020
1 parent 43f7bef commit 23b6e57
Show file tree
Hide file tree
Showing 324 changed files with 4,435 additions and 3,570 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
**/vendor/
/_gh_pages/
/js/coverage/
/site/sw.js
/site/static/sw.js
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ and/or [`/bootstrap/js/src/`](https://github.com/twbs/bootstrap/tree/v4-dev/js/s

Similarly, when contributing to Bootstrap's documentation, you should edit the
documentation source files in
[the `/bootstrap/site/docs/` directory of the `v4-dev` branch](https://github.com/twbs/bootstrap/tree/v4-dev/site/docs).
[the `/bootstrap/site/content/docs/` directory of the `v4-dev` branch](https://github.com/twbs/bootstrap/tree/v4-dev/site/content/docs).
**Do not edit the `gh-pages` branch.** That branch is generated from the
documentation source files and is managed separately by the Bootstrap Core Team.

Expand Down
32 changes: 1 addition & 31 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
env:
CI: true
NODE: 14.x
RUBY: 2.7.x

jobs:
docs:
Expand All @@ -24,25 +23,7 @@ jobs:
with:
node-version: "${{ env.NODE }}"

- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY }}

- name: Set up Ruby env
run: |
echo "gem: --no-document" > ~/.gemrc # Disable gem docs
bundle config set clean 'true'
bundle config set deployment 'true'
- name: Set up Ruby cache
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-ruby-v${{ env.RUBY }}-${{ hashFiles('Gemfile') }}-${{ hashFiles('Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-ruby-v${{ env.RUBY }}-${{ hashFiles('Gemfile') }}-${{ hashFiles('Gemfile.lock') }}
${{ runner.os }}-ruby-v${{ env.RUBY }}-
- run: java -version

- name: Set up npm cache
uses: actions/cache@v2
Expand All @@ -53,19 +34,8 @@ jobs:
${{ runner.OS }}-node-v${{ env.NODE }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
${{ runner.OS }}-node-v${{ env.NODE }}-
- run: ruby --version
- run: gem --version
- run: bundle --version
- run: java -version

- name: Install npm dependencies
run: npm ci

- name: Install bundler dependencies
run: bundle install --deployment --jobs=4 --retry=3 --clean

- name: Copy CSS and JS
run: npm run css-copy && npm run js-copy

- name: Test docs
run: npm run docs
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
# Ignore docs files
/_gh_pages/
/site/.jekyll-cache
/site/.jekyll-metadata
/site/docs/**/dist/
# Hugo folders
/resources/

# Ignore ruby/bundler files
/.bundle/
/vendor/
/.ruby-version

# Numerous always-ignore extensions
*.diff
*.err
Expand Down
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
**/dist/
**/vendor/
/_gh_pages/
/js/coverage/
9 changes: 0 additions & 9 deletions Gemfile

This file was deleted.

89 changes: 0 additions & 89 deletions Gemfile.lock

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,18 @@ Have a bug or a feature request? Please first read the [issue guidelines](https:

## Documentation

Bootstrap's documentation, included in this repo in the root directory, is built with [Jekyll](https://jekyllrb.com/) and publicly hosted on GitHub Pages at <https://getbootstrap.com/>. The docs may also be run locally.
Bootstrap's documentation, included in this repo in the root directory, is built with [Hugo](https://gohugo.io/) and publicly hosted on GitHub Pages at <https://getbootstrap.com/>. The docs may also be run locally.

Documentation search is powered by [Algolia's DocSearch](https://community.algolia.com/docsearch/). Working on our search? Be sure to set `debug: true` in `site/docs/4.5/assets/js/src/search.js` file.
Documentation search is powered by [Algolia's DocSearch](https://community.algolia.com/docsearch/). Working on our search? Be sure to set `debug: true` in `site/assets/js/src/search.js` file.

### Running documentation locally

1. Run through the [tooling setup](https://getbootstrap.com/docs/4.5/getting-started/build-tools/#tooling-setup) to install Jekyll (the site builder) and other Ruby dependencies with `bundle install`.
2. Run `npm install` to install Node.js dependencies.
1. Run `npm install` to install the Node.js dependencies, including Hugo (the site builder).
2. Run `npm run test` (or a specific npm script) to rebuild distributed CSS and JavaScript files, as well as our docs assets.
3. Run `npm start` to compile CSS and JavaScript files, generate our docs, and watch for changes.
4. Open `http://localhost:9001` in your browser, and voilà.
4. Open `http://localhost:9001/` in your browser, and voilà.

Learn more about using Jekyll by reading its [documentation](https://jekyllrb.com/docs/).
Learn more about using Hugo by reading its [documentation](https://gohugo.io/documentation/).

### Documentation for previous releases

Expand Down
77 changes: 0 additions & 77 deletions _config.yml

This file was deleted.

8 changes: 3 additions & 5 deletions build/generate-sri.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ const fs = require('fs')
const path = require('path')
const sh = require('shelljs')

const pkg = require('../package.json')

sh.config.fatal = true

const configFile = path.join(__dirname, '../_config.yml')
const configFile = path.join(__dirname, '../config.yml')

// Array of objects which holds the files to generate SRI hashes for.
// `file` is the path from the root folder
// `configPropertyName` is the _config.yml variable's name of the file
// `configPropertyName` is the config.yml variable's name of the file
const files = [
{
file: 'dist/css/bootstrap.min.css',
Expand All @@ -40,7 +38,7 @@ const files = [
configPropertyName: 'js_bundle_hash'
},
{
file: `site/docs/${pkg.version_short}/assets/js/vendor/jquery.slim.min.js`,
file: 'site/assets/js/vendor/jquery.slim.min.js',
configPropertyName: 'jquery_hash'
},
{
Expand Down

0 comments on commit 23b6e57

Please sign in to comment.