зеркало из https://github.com/github/docs.git
ba310bf991
* add frontend search support for GHAE version * add support for GHAE version to Algolia sync * add browser tests for frontend search * if a version can be derived from a path, but it is not a real version (like from a path that 404s), fall back to dotcom * Update javascripts/search.js * Update lib/algolia/sync.js |
||
---|---|---|
.. | ||
README.md | ||
copy-code.js | ||
deprecation-banner.js | ||
display-platform-specific-content.js | ||
events.js | ||
experiment.js | ||
explorer.js | ||
get-csrf.js | ||
helpfulness.js | ||
index.js | ||
localization.js | ||
nav.js | ||
print.js | ||
search.js | ||
sidebar.js | ||
user-agent.js | ||
wrap-code-terms.js |
README.md
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.