Skip to content

Development & Test Environments

Cotes Chung edited this page Aug 16, 2023 · 12 revisions

Run Jekyll Server

Compiling JS files

To run the project, you need to compile JS for it. So setup Node.js first, then run the following command.

npm i && npm run build

The compiled output (*.min.js) will be in assets/js/dist/.

Setup Jekyll

Follow the instructions in the Jekyll Docs to complete the installation of the basic environment. Git also needs to be installed.

Before the first run, go to the root directory and install the dependencies:

bundle

And then start the local server.

./tools/run

Modifying JavaScript

If your changes involve JavaScript, please read the following sections.

Inline JavaScript / JSON comments

For inline JS (code between <script> and </script>) or JS / JSON file containing Front Matter, if you want to add comments to it, please use /* */ instead of two slashes //. Because in a production environment, jekyll-compress-html will compress the HTML file, but it does not handle // correctly and therefore breaks the HTML structure.

External JavaScript

If you changed the files in the _javascript/ directory, then you need to rebuild the JS. During the development, real-time debugging can be performed through the following commands:

Firstly, start a Jekyll server:

./tools/run

And then open a new terminal sessioin and run:

npm run watch

When you are finished developing, press ctrl + C to end the npm process above, and then run the npm run build command. The new compressed JS files will be exported to assets/js/dist/.

How To Pass the CI Tests

This project has CI turned on. In order for your pull request to pass the test, please read the following.

Verify the Commits

Before you create a git commit, please complete the following setup.

Install commitlint & husky:

npm i -g @commitlint/{cli,config-conventional} husky

And then enable husky:

husky install

Check the Core Functionality

bash ./tools/test

Check the SASS Code Style

npm test
Clone this wiki locally