|
1 | 1 | --- |
2 | 2 | layout: docs |
3 | 3 | 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. |
5 | 5 | group: getting-started |
6 | 6 | aliases: |
7 | 7 | - "/docs/getting-started/download/" |
8 | 8 | toc: true |
9 | 9 | --- |
10 | 10 |
|
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> |
0 commit comments