CodeForTucson / codefortucson-site

Current Code for Tucson website
http://www.codefortucson.org
GNU General Public License v2.0
3 stars 8 forks source link

Framework: Remove all current JavaScript #39

Closed dmsnell closed 9 years ago

dmsnell commented 9 years ago

I noticed that we were loading jQuery and bootstrap but I couldn't find any real need for those. The one snippet of code I did find was a small bit adding the "active" class onto the current navigational menu item and also a little big of magic provided by bootstrap to open the dropdown menu.

For the "active" class I was able to replace this with nothing more than a simple template conditional and the addition of a pseudo-permament slug for each page. This slug should be more invariant than a title or URL might be, so we should be able to count on it to identify the active page. As a bonus, the dropdown menu root item can also inherit the "active" status because we are handling this in the template directly.

The dropdown functionality was easy to replace with a single CSS property. For some reason the old link for "About" was the calendar, but I wiped out the actual link on the dropdown parent so it wouldn't matter anyway what it previously was.

Cutting out jQuery and bootstap cut about 100 kB from the page load.

Visually inspect the pages for issues. I tried to match up all the pages linked in the navigation and didn't see any issues. The "active" class applied as expected.

There might be parts of the site I missed in testing, so it would be good to rerun a comprehensive visual inspection.