Sage 10 and the current lack of DOM-based routing

I’ve been using Sage 10 for a couple of projects and it’s already working pretty great. The only thing that seems to be missing is the DOM-routing setup from Sage 9. Looking at the repository it was at one point part of Sage 10 via js-dom-router, but all support seems to have been scrapped.

Is js-dom-router going to make a return, or is there another best practice at this point? The pattern and the promise of dynamic imports seem quite useful.

2 Likes

Hai, I also wondered about that, found: https://github.com/roots/sage/commit/2c5479995d67670eccc2adc2553b1961dee5c057

  • [Sage 10] Replace jQuery’s .ready() (#2182)

  • Use DOMContentLoaded listener for document ready

  • Account for DOMContentLoaded not firing

  • Extract ready() to utils.js

Also uses window.setTimeout(fn, 0) to cover async.

In a commit/PR in the near future, the util directory will be going
away since the DOM router has been extracted to its own package
(https://github.com/roots/js-dom-router). utils.js will function as a
place for custom utilities, similar to what app/helpers.php is on the
PHP side of things.

This topic was automatically closed after 42 days. New replies are no longer allowed.