1
0
mirror of synced 2025-12-25 11:03:37 -05:00
Files
docs/javascripts
Rachael Sewell f0a083d0c9 set default platform when content doesnt include the os platform (#19827)
* set default platform when content doesnt include the os platform

* update source array

* extract detect platforms into separate function

* rename set to get

* align names

* add comments

* Update display-platform-specific-content.ts

* Update display-platform-specific-content.ts

Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
2021-06-14 20:28:36 +00:00
..
2020-09-27 14:10:11 +02:00

Javascripts

The code in this directory is destined to run in a web browser!

The index.js file in this directory is bundled by Webpack. In development, we use webpack-dev-middleware to bundle automatically while running the server. In production, we run webpack --mode production via npm run build.

This file is then referenced in the footer:

<script src="/dist/index.js"></script>

Every other file in this directory is written as a module to be required in index.js. They all have this format:

module.exports = () => {
  // Do some cool browser stuff
  // Note: by the time this runs, the DOM will be ready. :)
}

In development, the bundle will recompile every time a file used by javascripts/index.js is changed. This ensures that you're always getting an up-to-date version of the script.

In production, the bundle is compiled during build-time.