1.0.3 • Published 2 years ago
@revanode/vanilla-router v1.0.3
vanilla-router
A router for vanilla HTML, CSS, JS
Docs:
Example project:
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>project</title>
<script src="./node_modules/@revanode/vanilla-router/index.js"></script>
</head>
<body id="main">
<a href="/other-page">other page</a>
</body>
<script>
VanillaRouter.route('/other-page', './other-page.html');
VanillaRouter.notfound('./404.html');
VanillaRouter.mount('main');
</script>
</html>
other-page.html:
other page
404.html:
not found
And yes, the address bar updates with the route without actually opening it and instead changing page in JS.
Changing pages is instant because every route and page is loaded into memory.