Modify JsReg and CSSReg to use routes.

TODO: Make it more generic.