Refactor main layout.

* create helper functions to handle CDN fallbacks
* ensure asset library versions are the same