lowRISC / lowrisc-web

lowrisc.org web site sources
https://www.lowrisc.org
Apache License 2.0
3 stars 6 forks source link

Remove dependency on Node.js, Bootstrap, and jQuery #103

Closed jwnrt closed 3 months ago

jwnrt commented 1 year ago

This PR allows the site to build with just Hugo, and removes all of the Node setup. Best reviewed by commit.

The current build uses Node.js for pulling dependencies and pre-processing before Hugo runs:

Hugo has support for processing SASS as well as minifying JS using pipes. I've moved the SASS processing to this, but decided to just drop our JS dependencies (Bootstrap's collapse.js plus its dependency on jQuery).

We're only using this for the toggle button in the navbar. I've replaced it with this function which has the same functionality but loses the smooth sliding transition when the navbar opens and closes:

<button /* ... */ onclick="document.getElementById('navbarCollapse').classList.toggle('show')>...</button>

The smooth transition could be added back in a future PR if wanted, possibly through a CSS transition or by updating to Bootstrap 5 which doesn't need the jQuery dependency and is lighter. Not including in this PR since it's already a huge change.

luismarques commented 1 year ago

Looking good so far. For the collapse.js removal, would it be possible to add a CSS transition to replace the current one?

HU90m commented 1 year ago

This made my day. It looks great.

Do we want to update the CI setup before merging?

Also, we could use transition-property, transition-duration and transition-timing-function to add the pretty animation back to navbar-toggler. I can add this later though.

jwnrt commented 1 year ago

Looking good so far. For the collapse.js removal, would it be possible to add a CSS transition to replace the current one?

Almost certainly, but I haven't done this before. @HU90m do you know how simple these are to add?

Alternatively, the Bootstrap 5 version of collapse.js doesn't need jQuery so would be lighter than out current Bootstrap 4 setup + jQuery, but still probably more than we need. Would also have to check the JS works with our Bootstrap 4 SASS, but maybe we could update this too.

jwnrt commented 1 year ago

Do we want to update the CI setup before merging?

I will try and get this working. Currently it's starting the server fine but then doing nothing for 30 minutes and killing everything. I need to work out what it's expecting to happen and fix that.

jwnrt commented 1 year ago

CI fixed. Netlify wanted to serve the site itself.

HU90m commented 1 year ago

Almost certainly, but I haven't done this before. @HU90m do you know how simple these are to add?

Super simple, but if we are already using bootstrap maybe avoiding custom CSS would be better. I like your idea of moving to Bootstrap 5.

This PR is already pretty big though. It might be a good idea to merge this in. Then looking at adding the animation back, possibly while updating to Bootstrap 5.

jwnrt commented 3 months ago

Website was moved to wordpress so this is moot.