Support modern JavaScript
This adds support for modern JS in the docs project.
All modern js should be added to the content/frontend/
directory.
Files in the content/frontend/bundles/
directory will be built by rollup-js to the public/frontend/bundles/
directory.
New system requirements
NOTE: This also adds two new system requirements namely node
and yarn
.
-
A warning will be produced in the terminal if these requirements are not met.
-
Documentation for installing
node
andyarn
is included in this MR. -
Dependencies required by
yarn bundle
will automatically be installed during compillation.
Adding a new bundle
Note: you should replace <bundle-name>
with whatever you'd like to call your bundle. Ideally, the layout name (html) and bundle name (js) should match to make it easier to find.
- Add the new bundle to
content/frontend/bundles/<bundle-name>.js
- Import the bundle in the html file:
layouts/<bundle-name>.html
<script src="<%= @items['/frontend/bundles/<bundle-name>.*'].path %>"></script>
TODO
-
Add new build image to https://gitlab.com/gitlab-org/gitlab-build-images -
Add sample file to frontend/bundles/
-
Add/Update documentation -
Add support for Vue (separate issue) #441 (closed) -
Add unit testing framework (separate issue) #442 (closed) -
Add additional checks/warnings if a dev environment does not have node
and/oryarn
installed
Closes #407 (closed)