uci-ieee / ops-webpages

0 stars 2 forks source link

OPS Webpages

Preview Site

Developing Guide

Requirements

First-Time Setup

Installation Instructions

Git

Node

SASS/SCSS

Running SASS/SCSS

Development Process

Workflows and SASS Compilation

The SCSS gets compiled in to CSS. Locally, this is done via the npm run sass and npm run sass-watch, but when the site is deployed onto the internet, this is done via a GitHub action.

The GitHub workflow file lives in the ieee-website-2023-2024 repository's scss_compile_deploy.yml file. Specifically, the step being done is the Compile SCSS step.

When new SASS files are created, they need to be imported into scss/custom.scss. It should be imported similarly to the following by adding an @import followed by the path of the new scss file:

// add imports of all scss files
@import "./index.scss";
@import "./project/project_template.scss";
@import "./js/ops_header.scss";
@import "./js/ops_footer.scss";

Cache Busting

Cache Busting is done by dynamically creating copies of the JS files in the js directory with a hash in the name. For example, ops_header.js will become ops_header.137e471e540f8f5fd304a5f32d713fab.js.

Here is the entire process, contained in scripts/hash.js:

  1. Copies of the js files are made with the new hash name generated
  2. Every HTML file that contains a reference to a .js file will be replaced with the hashed name.

This is done in the GitHub workflows, using the npm run cache-busting. As such, do not run this command while developing locally as it generates unnecessary and duplicate files. If it's run on accident, do not commit. Fix all the modifications to all the js files, or if it proves to be too much, restore.

Run git status to check all the untracked files. If the only untracked files are the hashed js files, then run git clean -f to delete all the hashed js file copies. This command deletes all the untracked files.

Run git restore [html files] where you add all the html files.

git restore index.html lectures.html workshops.html syllabus.html and so on...

If this is committed, then all the JS will be broken...