docs/javascripts
Grace Park e58570e28d
Part 4: React Cleanup after new 404/500 pages (#20465)
* remove 404 and 500 layouts

* removing unneeded liquid tags

* remove unnecessary includes

* remove javascripts

* adding liquid tags and update Dockerfile

* add tool-switcher
2021-07-22 08:59:34 -07:00
..
README.md fix: support the rewrite of browser rendered javascripts to typescripts 2021-07-01 23:54:30 +01:00
copy-code.ts React: import necessary javascripts directly (#20001) 2021-06-21 21:55:49 +00:00
display-platform-specific-content.ts SubLanding page filter (#19918) 2021-06-15 18:16:24 +00:00
display-tool-specific-content.ts fix ts bug (#19945) 2021-06-15 22:44:02 +00:00
events.ts Only send beacons if the feature is not disabled (#20282) 2021-07-02 19:42:42 +00:00
experiment.ts React: import necessary javascripts directly (#20001) 2021-06-21 21:55:49 +00:00
get-csrf.ts Update current JavaScripts to use Typescript (#19824) 2021-06-14 18:07:39 +00:00
index.ts Part 4: React Cleanup after new 404/500 pages (#20465) 2021-07-22 08:59:34 -07:00
localization.ts Update current JavaScripts to use Typescript (#19824) 2021-06-14 18:07:39 +00:00
scroll-anchoring.d.ts React: All landing pages (#19943) 2021-06-17 10:04:53 -07:00
toggle-images.ts Update current JavaScripts to use Typescript (#19824) 2021-06-14 18:07:39 +00:00
user-agent.ts Update current JavaScripts to use Typescript (#19824) 2021-06-14 18:07:39 +00:00
wrap-code-terms.ts Fix NextJS 500s (#20048) 2021-06-22 17:30:40 +00:00

README.md

Javascripts

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

The index.ts 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.ts. 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.ts 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.