Skip to content

Files

Latest commit

d7eb248 Β· Jan 5, 2021

History

History
This branch is 2 commits ahead of, 49683 commits behind github/docs:main.

javascripts

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Sep 27, 2020
Nov 12, 2020
Oct 16, 2020
Nov 17, 2020
Dec 9, 2020
Nov 19, 2020
Nov 20, 2020
Dec 3, 2020
Dec 2, 2020
Dec 7, 2020
Sep 28, 2020
Nov 20, 2020
Dec 7, 2020
Sep 27, 2020
Nov 17, 2020
Dec 14, 2020
Jan 5, 2021
Nov 17, 2020
Oct 21, 2020
Nov 9, 2020

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.