Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@sanillajs/sanilla-router

tree-some29MIT1.0.2

HTML5 history api router for Sanilla

spa, sanilla, javascript, js, html, framework, single page application, router, history

readme

Sanilla Router

HTML5 history api router for Sanilla

enter image description here

Install

npm

npm install -D @sanillajs/sanilla-router

yarn

yarn add -D @sanillajs/sanilla-router

How to use

import Sanilla from '@sanillajs/sanilla';
import SanillaRouter from '@sanillajs/sanilla-router';

import app from './app.html';
import home from './views/home.html';
import about from './views/about.html';
import hello from './views/hello.html';

Sanilla.append('#root', app);
Sanilla.router = new SanillaRouter('#router', {
    '/': home,
    '/about': about,
    '/hello': hello,
});