-
Notifications
You must be signed in to change notification settings - Fork 31
Conversation
@jmcarp this is looking great so far. So this will be done for every page the has lots of different requirements, or all pages? |
I was thinking we'd only add page-specific JS files for pages that need significant customization. So there probably wouldn't be JS files for the homepage or other pages without data tables or charts. |
Yea I'd agree with that approach |
This is now up to date with develop and seems to be working fine. I tried to structure the changes to avoid merge conflicts with other ongoing features, and I'm happy to resolve any conflicts that come up. Pinging @msecret and @noahmanger for review. |
@jmcarp this looks good. Just so I'm clear, common.js is all the code not part of pages? When merge conflicts are fixed, I'm ready to merge. |
@msecret: merge conflicts are fixed. Running the updated |
Code splitting with factor-bundle.
We currently bundle all JS (vendor libraries, internal modules, and initialization code) into a single bundle. There are a few problems with this:
tables.js
includes a large and growingswitch
statement keyed on attributes of the table DOM node to figure out what kind of table to draw. The code would be simpler to read and write with per-page initialization files.This is a proof of concept using factor-bundle to write small per-page initialization files for a few pages. Check out
committees.js
andcandidates.js
, which initialize data tables for the committees and candidates pages respectively. Each file only has to initialize data tables for a single page, and we can move all the page-specific logic out oftables.js
, which becomes a simpler module of reusable functions.This isn't complete and not ready for merge, but I can get it into shape if we want to use it. Thoughts @noahmanger @msecret?