Skip to content

Commit

Permalink
Reorganize docs for easier deploys
Browse files Browse the repository at this point in the history
With the current docs directory setup, I'm making too many mistakes and have to manually address path changes and directory moves on deploy. This makes for a frustrating experience developing locally and shipping releases. With this PR, we're basically back to the same setup from v3—duplicating the dist directory into our docs directory. Not the most ideal, but very straightforward for me as the release manager.
  • Loading branch information
mdo committed Jul 12, 2018
1 parent 9e126b2 commit 0e920ce
Show file tree
Hide file tree
Showing 243 changed files with 171 additions and 186 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Ignore docs files
_gh_pages
_site
site/docs/4.1/dist/

# Ignore ruby files
.ruby-version
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://getbootstrap.com/">
<img src="https://getbootstrap.com/docs/4.1/assets/brand/bootstrap-solid.svg" alt="Logo" width=72 height=72>
<img src="https://getbootstrap.com/docs/4.1/assets/brand/bootstrap-solid.svg" alt="Bootstrap logo" width=72 height=72>
</a>

<h3 align="center">Bootstrap</h3>
Expand Down Expand Up @@ -111,11 +111,11 @@ Have a bug or a feature request? Please first read the [issue guidelines](https:

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.

Documentation search is powered by [Algolia's DocSearch](https://community.algolia.com/docsearch/). Working on our search? Be sure to set `debug: true` in `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/docs/4.1/assets/js/src/search.js` file.

### Running documentation locally

1. Run through the [tooling setup](https://getbootstrap.com/docs/4.0/getting-started/build-tools/#tooling-setup) to install Jekyll (the site builder) and other Ruby dependencies with `bundle install`.
1. Run through the [tooling setup](https://getbootstrap.com/docs/4.1/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.
3. Run `npm run test` (or a specific NPM script) to rebuild distributed CSS and JavaScript files, as well as our docs assets.
4. From the root `/bootstrap` directory, run `npm run docs-serve` in the command line.
Expand Down
22 changes: 2 additions & 20 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,15 @@ kramdown:
permalink: pretty

# Server
source: "."
source: "site"
destination: ./_gh_pages
host: 0.0.0.0
port: 9001
baseurl: ""
url: "https://getbootstrap.com"
encoding: UTF-8
exclude:
- .git/
- .github/
- assets/scss/
- build/
- js/
- node_modules/
- nuget/
- scss/
- vendor/
- CODE_OF_CONDUCT.md
- composer.json
- Gemfile
- Gemfile.lock
- package.js
- package.json
- package-lock.json
- README.md
- sache.json
- twbsconfig.yml
- docs/4.1/assets/scss/

plugins:
- jekyll-redirect-from
Expand Down
9 changes: 0 additions & 9 deletions _includes/favicons.html

This file was deleted.

26 changes: 0 additions & 26 deletions _includes/scripts.html

This file was deleted.

1 change: 0 additions & 1 deletion assets/css/docs.min.css.map

This file was deleted.

4 changes: 2 additions & 2 deletions build/generate-sri.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ const files = [
configPropertyName: 'js_hash'
},
{
file: 'assets/js/vendor/jquery-slim.min.js',
file: 'site/docs/4.1/assets/js/vendor/jquery-slim.min.js',
configPropertyName: 'jquery_hash'
},
{
file: 'assets/js/vendor/popper.min.js',
file: 'site/docs/4.1/assets/js/vendor/popper.min.js',
configPropertyName: 'popper_hash'
}
]
Expand Down
2 changes: 1 addition & 1 deletion build/workbox.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"globPatterns": [
"_gh_pages/**/*.{html,css,js,json,png,svg}"
],
"swSrc": "./sw.js",
"swSrc": "./site/sw.js",
"swDest": "./_gh_pages/sw.js"
}
2 changes: 1 addition & 1 deletion build/workbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const buildPrefix = '_gh_pages/'

const workboxSWSrcPath = require.resolve('workbox-sw')
const wbFileName = path.basename(workboxSWSrcPath)
const workboxSWDestPath = `${buildPrefix}assets/js/vendor/${wbFileName}`
const workboxSWDestPath = `${buildPrefix}docs/4.1/assets/js/vendor/${wbFileName}`
const workboxSWSrcMapPath = `${workboxSWSrcPath}.map`
const workboxSWDestMapPath = `${workboxSWDestPath}.map`

Expand Down
4 changes: 2 additions & 2 deletions js/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!-- jQuery -->
<script>
(function () {
var path = '../../assets/js/vendor/jquery-slim.min.js'
var path = '../../site/docs/4.1/assets/js/vendor/jquery-slim.min.js'
// get jquery param from the query string.
var jQueryVersion = location.search.match(/[?&]jquery=(.*?)(?=&|$)/)

Expand All @@ -19,7 +19,7 @@
document.write('<script src="' + path + '"><\/script>')
}())
</script>
<script src="../../assets/js/vendor/popper.min.js"></script>
<script src="../../site/docs/4.1/assets/js/vendor/popper.min.js"></script>

<!-- QUnit -->
<link rel="stylesheet" href="../../node_modules/qunit/qunit/qunit.css" media="screen">
Expand Down
4 changes: 2 additions & 2 deletions js/tests/karma-bundle.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint no-process-env: 0 */

module.exports = (config) => {
const jqueryFile = process.env.USE_OLD_JQUERY ? 'https://code.jquery.com/jquery-1.9.1.min.js' : 'assets/js/vendor/jquery-slim.min.js'
const jqueryFile = process.env.USE_OLD_JQUERY ? 'https://code.jquery.com/jquery-1.9.1.min.js' : 'site/docs/4.1/assets/js/vendor/jquery-slim.min.js'

config.set({
basePath: '../..',
Expand All @@ -17,7 +17,7 @@ module.exports = (config) => {
// list of files / patterns to load in the browser
files: [
jqueryFile,
'assets/js/vendor/popper.min.js',
'site/docs/4.1/assets/js/vendor/popper.min.js',
'dist/js/bootstrap.js',
'js/tests/unit/*.js'
],
Expand Down
4 changes: 2 additions & 2 deletions js/tests/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const path = require('path')
const jsCoveragePath = path.resolve(__dirname, '../coverage')

module.exports = (config) => {
const jqueryFile = process.env.USE_OLD_JQUERY ? 'https://code.jquery.com/jquery-1.9.1.min.js' : 'assets/js/vendor/jquery-slim.min.js'
const jqueryFile = process.env.USE_OLD_JQUERY ? 'https://code.jquery.com/jquery-1.9.1.min.js' : 'site/docs/4.1/assets/js/vendor/jquery-slim.min.js'

config.set({
basePath: '../..',
Expand All @@ -20,7 +20,7 @@ module.exports = (config) => {
// list of files / patterns to load in the browser
files: [
jqueryFile,
'assets/js/vendor/popper.min.js',
'site/docs/4.1/assets/js/vendor/popper.min.js',
'js/coverage/dist/util.js',
'js/coverage/dist/tooltip.js',
'js/coverage/dist/!(util|index|tooltip).js', // include all of our js/dist files except util.js, index.js and tooltip.js
Expand Down
2 changes: 1 addition & 1 deletion nuget/bootstrap.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<summary>Bootstrap framework in CSS. Includes fonts and JavaScript</summary>
<language>en-us</language>
<projectUrl>https://getbootstrap.com/</projectUrl>
<iconUrl>https://getbootstrap.com/assets/img/favicons/apple-touch-icon.png</iconUrl>
<iconUrl>https://getbootstrap.com/docs/4.1/assets/img/favicons/apple-touch-icon.png</iconUrl>
<licenseUrl>https://github.com/twbs/bootstrap/blob/master/LICENSE</licenseUrl>
<copyright>Copyright 2017-2018</copyright>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
Expand Down
2 changes: 1 addition & 1 deletion nuget/bootstrap.sass.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<summary>Bootstrap framework in Sass. Includes fonts and JavaScript</summary>
<language>en-us</language>
<projectUrl>https://getbootstrap.com/</projectUrl>
<iconUrl>https://getbootstrap.com/assets/img/favicons/apple-touch-icon.png</iconUrl>
<iconUrl>https://getbootstrap.com/docs/4.1/assets/img/favicons/apple-touch-icon.png</iconUrl>
<licenseUrl>https://github.com/twbs/bootstrap/blob/master/LICENSE</licenseUrl>
<copyright>Copyright 2017-2018</copyright>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
Expand Down
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,25 @@
"http-server": "http-server --silent -p 3000",
"bundlesize": "bundlesize",
"check-broken-links": "npm-run-all --parallel --race \"http-server -- _gh_pages/\" blc",
"css": "npm-run-all --parallel css-lint* css-compile* --sequential css-prefix* css-minify*",
"css": "npm-run-all --parallel css-lint* css-compile* --sequential css-prefix* css-minify* css-copy",
"css-main": "npm-run-all --parallel css-lint css-compile --sequential css-prefix css-minify",
"css-docs": "npm-run-all --parallel css-lint-docs css-compile-docs --sequential css-prefix-docs css-minify-docs",
"css-compile": "node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 scss/bootstrap.scss dist/css/bootstrap.css && node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 scss/bootstrap-grid.scss dist/css/bootstrap-grid.css && node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 scss/bootstrap-reboot.scss dist/css/bootstrap-reboot.css",
"css-compile-docs": "node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 assets/scss/docs.scss assets/css/docs.min.css",
"css-compile-docs": "node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 site/docs/4.1/assets/scss/docs.scss site/docs/4.1/assets/css/docs.min.css",
"css-copy": "shx mkdir -p site/docs/4.1/dist/ && shx cp -r dist/css/ site/docs/4.1/dist/",
"css-lint": "stylelint --syntax scss \"scss/**/*.scss\"",
"css-lint-docs": "stylelint --syntax scss \"assets/scss/*.scss\" && stylelint \"docs/**/*.css\"",
"css-lint-vars": "node build/lint-vars.js scss/ assets/scss/",
"css-lint-docs": "stylelint --syntax scss \"site/docs/4.1/assets/scss/*.scss\" && stylelint \"docs/**/*.css\"",
"css-lint-vars": "node build/lint-vars.js scss/ site/docs/4.1/assets/scss/",
"css-prefix": "postcss --config build/postcss.config.js --replace \"dist/css/*.css\" \"!dist/css/*.min.css\"",
"css-prefix-docs": "postcss --config build/postcss.config.js --replace \"assets/css/docs.min.css\" \"docs/**/*.css\"",
"css-prefix-docs": "postcss --config build/postcss.config.js --replace \"site/docs/4.1/assets/css/docs.min.css\" \"docs/**/*.css\"",
"css-minify": "cleancss --level 1 --source-map --source-map-inline-sources --output dist/css/bootstrap.min.css dist/css/bootstrap.css && cleancss --level 1 --source-map --source-map-inline-sources --output dist/css/bootstrap-grid.min.css dist/css/bootstrap-grid.css && cleancss --level 1 --source-map --source-map-inline-sources --output dist/css/bootstrap-reboot.min.css dist/css/bootstrap-reboot.css",
"css-minify-docs": "cleancss --level 1 --source-map --source-map-inline-sources --output assets/css/docs.min.css assets/css/docs.min.css",
"js": "npm-run-all js-lint* js-compile js-minify",
"css-minify-docs": "cleancss --level 1 --source-map --source-map-inline-sources --output site/docs/4.1/assets/css/docs.min.css site/docs/4.1/assets/css/docs.min.css",
"js": "npm-run-all js-lint* js-compile js-minify js-copy",
"js-copy": "shx mkdir -p site/docs/4.1/dist/ && shx cp -r dist/js/ site/docs/4.1/dist/",
"js-main": "npm-run-all js-lint js-compile js-minify",
"js-docs": "npm-run-all js-lint-docs js-minify-docs",
"js-lint": "eslint js/src js/tests build/",
"js-lint-docs": "eslint assets/js/ docs/ sw.js",
"js-lint-docs": "eslint site/docs/4.1/assets/js/ site/sw.js",
"js-compile": "npm-run-all --parallel js-compile-*",
"js-compile-standalone": "rollup --environment BUNDLE:false --config build/rollup.config.js --sourcemap",
"js-compile-bundle": "rollup --environment BUNDLE:true --config build/rollup.config.js --sourcemap",
Expand All @@ -46,7 +48,7 @@
"js-minify": "npm-run-all --parallel js-minify-*",
"js-minify-standalone": "uglifyjs --compress typeofs=false --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.js.map,includeSources,url=bootstrap.min.js.map\" --output dist/js/bootstrap.min.js dist/js/bootstrap.js",
"js-minify-bundle": "uglifyjs --compress typeofs=false --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.bundle.js.map,includeSources,url=bootstrap.bundle.min.js.map\" --output dist/js/bootstrap.bundle.min.js dist/js/bootstrap.bundle.js",
"js-minify-docs": "uglifyjs --mangle --comments \"/^!/\" --output assets/js/docs.min.js assets/js/vendor/anchor.min.js assets/js/vendor/clipboard.min.js assets/js/vendor/holder.min.js \"assets/js/src/*.js\"",
"js-minify-docs": "uglifyjs --mangle --comments \"/^!/\" --output site/docs/4.1/assets/js/docs.min.js site/docs/4.1/assets/js/vendor/anchor.min.js site/docs/4.1/assets/js/vendor/clipboard.min.js site/docs/4.1/assets/js/vendor/holder.min.js \"site/docs/4.1/assets/js/src/*.js\"",
"js-test": "npm-run-all js-test-karma*",
"js-test-karma": "karma start js/tests/karma.conf.js",
"js-test-karma-old": "cross-env USE_OLD_JQUERY=true npm run js-test-karma",
Expand All @@ -64,7 +66,7 @@
"docs-lint-vnu-jar": "node build/vnu-jar.js",
"docs-serve": "bundle exec jekyll serve",
"docs-workbox-precache": "node build/workbox.js",
"maintenance-dependencies": "ncu -a -x jquery && npm update && bundle update && shx echo \"Manually update assets/js/vendor/*, js/tests/vendor/* and .travis.yml\"",
"maintenance-dependencies": "ncu -a -x jquery && npm update && bundle update && shx echo \"Manually update site/docs/4.1/assets/js/vendor/*, js/tests/vendor/* and .travis.yml\"",
"release-sri": "node build/generate-sri.js",
"release-version": "node build/change-version.js",
"release-zip": "cd dist/ && zip -r9 bootstrap-$npm_package_version-dist.zip * && shx mv bootstrap-$npm_package_version-dist.zip ..",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions site/_includes/favicons.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- Favicons -->
<link rel="apple-touch-icon" href="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/img/favicons/apple-touch-icon.png" sizes="180x180">
<link rel="icon" href="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/img/favicons/favicon-32x32.png" sizes="32x32" type="image/png">
<link rel="icon" href="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/img/favicons/favicon-16x16.png" sizes="16x16" type="image/png">
<link rel="manifest" href="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/img/favicons/manifest.json">
<link rel="mask-icon" href="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/img/favicons/safari-pinned-tab.svg" color="#563d7c">
<link rel="icon" href="{{ site.baseurl }}/favicon.ico">
<meta name="msapplication-config" content="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/img/favicons/browserconfig.xml">
<meta name="theme-color" content="#563d7c">
File renamed without changes.
6 changes: 3 additions & 3 deletions _includes/header.html → site/_includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@

<!-- Bootstrap core CSS -->
{% if site.github %}
<link href="{{ site.baseurl }}/dist/css/bootstrap.min.css" rel="stylesheet" integrity="{{ site.cdn.css_hash }}" crossorigin="anonymous">
<link href="{{ site.baseurl }}/docs/{{ site.docs_version }}/dist/css/bootstrap.min.css" rel="stylesheet" integrity="{{ site.cdn.css_hash }}" crossorigin="anonymous">
{% else %}
<link href="{{ site.baseurl }}/dist/css/bootstrap.css" rel="stylesheet">
<link href="{{ site.baseurl }}/docs/{{ site.docs_version }}/dist/css/bootstrap.css" rel="stylesheet">
{% endif %}

<!-- Documentation extras -->
{% if page.layout == "docs" %}
<link href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" rel="stylesheet">
{% endif %}
<link href="{{ site.baseurl }}/assets/css/docs.min.css" rel="stylesheet">
<link href="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/css/docs.min.css" rel="stylesheet">

{% include favicons.html %}

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
26 changes: 26 additions & 0 deletions site/_includes/scripts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script src="{{ site.cdn.jquery }}" integrity="{{ site.cdn.jquery_hash }}" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="{{ site.baseurl }}/assets/js/vendor/jquery-slim.min.js"><\/script>')</script>

<script src="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/js/vendor/popper.min.js"{% if site.github %} integrity="{{ site.cdn.popper_hash }}" crossorigin="anonymous"{% endif %}></script>

{%- if site.github -%}
<script src="{{ site.baseurl }}/docs/{{ site.docs_version }}/dist/js/bootstrap.min.js" integrity="{{ site.cdn.js_hash }}" crossorigin="anonymous"></script>
{%- else -%}
<script src="{{ site.baseurl }}/docs/{{ site.docs_version }}/dist/js/bootstrap.js"></script>
{%- endif -%}

{%- if page.layout == "docs" -%}
<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
{%- endif -%}

{%- if site.github -%}
<script src="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/js/docs.min.js"></script>
{%- else -%}
<script src="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/js/vendor/anchor.min.js"></script>
<script src="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/js/vendor/clipboard.min.js"></script>
<script src="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/js/vendor/holder.min.js"></script>
<script src="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/js/src/application.js"></script>
<script src="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/js/src/search.js"></script>
<script src="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/js/src/ie-emulation-modes-warning.js"></script>
<script src="{{ site.baseurl }}/docs/{{ site.docs_version }}/assets/js/src/pwa.js"></script>
{%- endif -%}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 0e920ce

Please sign in to comment.