In total, I have 3 pages: index.html
, sketch.html
and user-profile.html
.
All of them have the same navbar (I just copied and pasted the nav
element for now), but I now realize that this is not the best idea.
The navbar has its position on the screen (HTML), the styling (CSS) and the login and register functionality (Javascript). How would I go about combining these for three different pages?
Since I am using a module bundler (Parcel.js), I was thinking of creating a .js
and .css
for EACH page. So for example the folder index
will have:
index.css
-> will import the necessary elements, example (pseudo-code): import "../styles/navbar.css"
index.js
-> will import the necessary scripting for logging and registering, example: require("..scripts/sessions.js");
index.html
-> will import those two files
... and do the same for each page.
But... is that really necessary? Is there a better way of doing this?