A new revolutionary small router with no bullshit!
RouteNow is a small library that will help you in developing a SinglePage Application without any dependencies like jQuery, AngularJs, vue.js or any of those bulky frameworks.
Installating RouteNow.js is as easy as it gets.
Add the script to the end of your body
<script src="../pathto/route-now.js"></script>
Or use the CDN link
<!-- For latest build use @latest -->
<script src="https://cdn.jsdelivr.net/gh/akhilarjun/RouteNow@latest/js/route-now.js"></script>
<!-- For specific version use the version tag -->
<script src="https://cdn.jsdelivr.net/gh/akhilarjun/[email protected]/js/route-now.js"></script>
<!-- For Minified -->
<script src="https://cdn.jsdelivr.net/gh/akhilarjun/[email protected]/js/route-now.min.js"></script>
Use anchor tags with r-href
property to point to your paths
<a r-href="home">Home</a>
Now add the Router outlet where the views should be populated
<div router-outlet></div>
Finally, map the paths to your templates and you are done.
$Router.config([
{path:'home',templateUrl:'partial/home.html'},
{path:'options',templateUrl:'partial/options.html'},
{path:'about',templateUrl:'partial/about.html'},
{path:'thankyou',templateUrl:'partial/thankyou.html'},
{otherwise:'home'}
]);
Check the API options for more customization options
$Router can be directly used as a browser global.
A sample server.js
is added with the repo, which spins up a Express
server at port 8080
Install and start the server by
npm install
npm start
- v2.0.1 Introducing HTML5 History API's pushState and popState as the default strategy for routing.
- v1.2.2 Added $Router.hash() method
- v1.2.1 Bug fix to prevent modules.export from breaking the library in script tags
- v1.2 Added common modules export support
- v1.1 First release