experimental client side router for speclate.
JavaScript HTML
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.vscode
lib
spec
tests
.npmignore
.DS_Store
.gitignore
.travis.yml
CHANGELOG.md
LICENCE
README.md
index.js
package.json

README.md

speclate-router

Greenkeeper badge

Client side router for speclate.

Given a speclate spec (github.com/simonmcmanus/speclate) Generates a page.js router:

Example

var router = require('speclate-router');
var spec = {
    '/': {
        page: 'home'
    }
};

router(spec, {
  before: function () {
      // before the page change.
  },
  after: function () {
      // after the page change.
    $('html,body').scrollTop($('#container'))
  },
  error: function (err) {
      location.reload()
  }
});

Notes

  • / gets replaces for /index.html

For an example see:

https://github.com/lnug/lnug.github.io/blob/master/client/index.js