Skip to content

Support modern JavaScript

Jacques Erasmus requested to merge support-modern-javascript into master

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 and yarn 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.

  1. Add the new bundle to content/frontend/bundles/<bundle-name>.js
  2. Import the bundle in the html file:

layouts/<bundle-name>.html

<script src="<%= @items['/frontend/bundles/<bundle-name>.*'].path %>"></script>

TODO


Closes #407 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports