Skip to content

Commit bdcf930

Browse files
hannahissvprothais
andauthored
docs: Add getting started>download page (#2908)
--------- Co-authored-by: Vincent Prothais <vincent.prothais@orange.com>
1 parent 9ab86ae commit bdcf930

File tree

6 files changed

+131
-12
lines changed

6 files changed

+131
-12
lines changed
Lines changed: 122 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,131 @@
11
---
22
layout: docs
33
title: Download
4-
description: Download OUDS Web to get the compiled CSS and JavaScript, source code, or include it with your favorite package managers like npm, RubyGems, and more.
4+
description: Download OUDS Web to get the compiled CSS and JavaScript, source code, or include it with your favorite package managers like npm, yarn, and more.
55
group: getting-started
66
aliases:
77
- "/docs/getting-started/download/"
88
toc: true
99
---
1010

11-
{{< callout-soon "page" >}}
11+
## Package managers
12+
13+
Pull in OUDS Web’s **source files** into nearly any project with some of the most popular package managers. No matter the package manager, OUDS Web will **require a [Sass compiler]({{< docsref "/getting-started/contribute#sass" >}}) and [Autoprefixer]({{< docsref "/getting-started/contribute#autoprefixer" >}})** for a setup that matches our official compiled versions.
14+
15+
### npm
16+
17+
Install OUDS Web in your Node.js powered apps with [the npm package](https://www.npmjs.com/package/@ouds/web):
18+
19+
```sh
20+
npm install @ouds/web@{{< param "current_version" >}}
21+
```
22+
23+
`const oudsWeb = require('oudsWeb')` or `import oudsWeb from 'oudsWeb'` will load all of OUDS Web's plugins onto a `oudsWeb` object.
24+
The `oudsWeb` module itself exports all of our plugins. You can manually load OUDS Web's plugins individually by loading the `/js/dist/*.js` files under the package's top-level directory.
25+
26+
OUDS Web's `package.json` contains some additional metadata under the following keys:
27+
28+
- `sass` - path to OUDS Web's main [Sass](https://sass-lang.com/) source file
29+
- `style` - path to OUDS Web's non-minified CSS that's been compiled using the default settings (no customization)
30+
31+
{{< callout info >}}
32+
{{< partial "callouts/info-npm-starter.md" >}}
33+
{{< /callout >}}
34+
35+
### yarn
36+
37+
Install OUDS Web in your Node.js powered apps with [the yarn package](https://yarnpkg.com/en/package/@ouds/web):
38+
39+
```sh
40+
yarn add @ouds/web@{{< param "current_version" >}}
41+
```
42+
43+
{{< callout warning >}}
44+
**Yarn 2+ (aka Yarn Berry) doesn't support the `node_modules` directory by default**: using the Bootstrap [Sass & JS example](https://github.com/twbs/examples/tree/main/sass-js) needs some adjustments:
45+
```sh
46+
yarn config set nodeLinker node-modules # Use the node_modules linker
47+
touch yarn.lock # Create an empty yarn.lock file
48+
yarn install # Install the dependencies
49+
yarn start # Start the project
50+
```
51+
{{< /callout >}}
52+
53+
### NuGet
54+
55+
If you develop in .NET Framework, you can also install and manage OUDS Web's [CSS](https://www.nuget.org/packages/ouds-web) or [Sass](https://www.nuget.org/packages/ouds-web.sass) and JavaScript using [NuGet](https://www.nuget.org/). Newer projects should use [libman](https://learn.microsoft.com/en-us/aspnet/core/client-side/libman/) or another method as NuGet is designed for compiled code, not frontend assets.
56+
57+
```powershell
58+
Install-Package ouds-web
59+
```
60+
61+
```powershell
62+
Install-Package ouds-web.sass
63+
```
64+
65+
## CDNs
66+
67+
### jsDelivr
68+
69+
We recommend [jsDelivr](https://www.jsdelivr.com/package/npm/@ouds/web/) as a CDN, and use it ourselves in our documentation to skip the download and deliver cached version of OUDS Web's compiled CSS and JS to your project.
70+
71+
```html
72+
<link href="https://cdn.jsdelivr.net" rel="preconnect" crossorigin="anonymous">
73+
<link href="{{< param "cdn.css" >}}" rel="stylesheet" integrity="{{< param "cdn.css_hash" >}}" crossorigin="anonymous">
74+
<script src="{{< param "cdn.js_bundle" >}}" integrity="{{< param "cdn.js_bundle_hash" >}}" crossorigin="anonymous"></script>
75+
```
76+
77+
If you're using our compiled JavaScript and prefer to include Popper separately, add Popper before our JS, via a CDN preferably.
78+
79+
```html
80+
<script src="{{< param "cdn.popper" >}}" integrity="{{< param "cdn.popper_hash" >}}" crossorigin="anonymous"></script>
81+
<script src="{{< param "cdn.js" >}}" integrity="{{< param "cdn.js_hash" >}}" crossorigin="anonymous"></script>
82+
```
83+
84+
{{< callout warning >}}
85+
**Resource hint**: make sure to use [`preconnect`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel/preconnect) where appropriate (**only** when given URL **will** be used).
86+
{{< /callout >}}
87+
88+
### Alternative CDN
89+
90+
In some cases—like in some specific countries or environments—you may need to use other CDN providers like [unpkg](https://www.unpkg.com/browse/@ouds/web@{{< param "current_version" >}}). You'll find the same files on these CDN providers, albeit with different URLs.
91+
92+
{{< callout warning>}}
93+
**If the SRI hashes differ for a given file, you shouldn't use the files from that CDN, because it means that the file was modified by someone else.**
94+
{{< /callout >}}
95+
96+
Note that you should compare same length hashes, e.g. `sha384` with `sha384`, otherwise it's expected for them to be different.
97+
As such, you can use an online tool like [SRI Hash Generator](https://www.srihash.org/) to make sure that the hashes are the same for a given file. Alternatively, assuming you have OpenSSL installed, you can achieve the same from the CLI, for example:
98+
99+
```sh
100+
openssl dgst -sha384 -binary ouds-web.min.js | openssl base64 -A
101+
```
102+
103+
## Downloads
104+
105+
### Compiled CSS and JS
106+
107+
Download ready-to-use compiled code for **OUDS Web v{{< param current_version >}}** to easily drop into your project, which includes:
108+
109+
- Compiled and minified CSS bundles (see [CSS files comparison]({{< docsref "/getting-started/contents#css-files" >}}))
110+
- Compiled and minified JavaScript plugins (see [JS files comparison]({{< docsref "/getting-started/contents#js-files" >}}))
111+
112+
This doesn't include documentation, source files, or any optional JavaScript dependencies like Popper.
113+
114+
<a href="{{< param "download.dist" >}}" class="btn btn-default" onclick="dataLayer.push({'event': 'clic', 'site_name':'accessibility-boosted', 'phase':'prod', 'track_category':'download', 'track_name':'getting started', 'track_cible':'download source'});">Download</a>
115+
116+
### Source files
117+
118+
Compile OUDS Web with your own asset pipeline by downloading our source Sass, JavaScript, and documentation files. This option requires some additional tooling:
119+
120+
- [Sass compiler]({{< docsref "/getting-started/contribute#sass" >}}) for compiling Sass source files into CSS files
121+
- [Autoprefixer]({{< docsref "/getting-started/contribute#autoprefixer" >}}) for CSS vendor prefixing
122+
123+
Should you require our full set of [build tools]({{< docsref "/getting-started/contribute#tooling-setup" >}}), they are included for developing OUDS Web and its docs, but they're likely unsuitable for your own purposes.
124+
125+
<a href="{{< param "download.source" >}}" class="btn btn-default" onclick="dataLayer.push({'event': 'clic', 'site_name':'accessibility-boosted', 'phase':'prod', 'track_category':'download', 'track_name':'getting started', 'track_cible':'download source'});">Download source</a>
126+
127+
### Examples
128+
129+
If you want to download and examine our [examples]({{< docsref "/examples" >}}), you can grab the already built examples:
130+
131+
<a href="{{< param "download.dist_examples" >}}" class="btn btn-default" onclick="dataLayer.push({'event': 'clic', 'site_name':'accessibility-boosted', 'phase':'prod', 'track_category':'download', 'track_name':'getting started', 'track_cible':'download examples source'});">Download examples</a>

site/data/sidebar.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
pages:
88
- title: Introduction
99
- title: Download
10-
draft: true
1110
- title: Contents
1211
- title: Browsers & devices
1312
- title: JavaScript
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
**Bootstrap starter project!**
2-
Head to the [Sass & JS example](https://github.com/twbs/examples/tree/main/sass-js) template repository to see how to build and customize Bootstrap in your own npm project. Includes Sass compiler, Autoprefixer, Stylelint, PurgeCSS, and Bootstrap Icons.
1+
**Get started with OUDS Web via npm with the starter project!**
2+
Head to the [Bootstrap starter templates repository](/docs/{{ .Site.Params.docs_version }}/examples/#starters), in particular Sass & JS, for inspiration on how to create and customize OUDS Web in your npm project. Includes the Sass compiler, Autoprefixer, Stylelint, PurgeCSS.

site/layouts/partials/examples/main.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h2 id="{{ $entry.category | urlize }}">{{ $entry.category }}</h2>
1313
{{ if eq $entry.category "Starters" -}}
1414
<div class="bd-callout bd-callout-warning mb-tallest">
1515
<p>
16-
<strong>To get working OUDS Web examples based on the Bootstrap ones</strong>, you need to replace all <code>bootstrap</code> occurrences with <code>ouds-web</code> in some files.
16+
<strong>To get working OUDS Web examples based on the Bootstrap ones</strong>, you need to replace all <code>bootstrap</code> occurrences with <code>oudsWeb</code> in some files.
1717
</p>
1818
<p>
1919
You may need to tweak a bit Sass files.
@@ -40,12 +40,12 @@ <h3 class="h5 mb-shortest">
4040
{{ $example.name }}
4141
</a>
4242
</h3>
43-
<p class="text-muted">{{ $example.description }}</p>
44-
<p>
43+
<p class="text-muted mb-none">{{ $example.description }}</p>
44+
<p class="mb-none">
4545
{{- $indexPath := default "index.html" $example.indexPath -}}
4646
{{- $stackBlitzUrl := printf "%s%s%s" (urls.JoinPath "https://stackblitz.com/github/twbs" $example.url) "?file=" ($indexPath | urlquery) }}
47-
<a class="icon-link link-offset-1" href="{{ $stackBlitzUrl }}" target="_blank" rel="noopener">
48-
<svg class="bi flex-shrink-0"><use xlink:href="#lightning-charge-fill"></use></svg>
47+
<a class="link icon-link link-sm link-offset-1" href="{{ $stackBlitzUrl }}" target="_blank" rel="noopener">
48+
<svg><use xlink:href="#lightning-charge-fill"></use></svg>
4949
Edit in StackBlitz
5050
</a>
5151
</p>

site/layouts/partials/header.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
{{- end }}
2121

2222
<!-- OUDS mod -->
23-
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin="anonymous">
2423
<link rel="preload" href="/docs/{{ .Site.Params.docs_version }}/assets/img/ouds-web-sprite.svg" as="image" type="image/svg+xml">
2524
<!-- end mod -->
2625

site/layouts/shortcodes/callout.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
*/ -}}
44

55
{{- $css_class := .Get 0 | default "info" -}}
6+
{{ $opts := dict "display" "block" }}
67

78
<div class="bd-callout bd-callout-{{ $css_class }}">
8-
{{ .Inner | markdownify }}
9+
{{ .Inner | .Page.RenderString $opts }}
910
</div>

0 commit comments

Comments
 (0)