Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alveflo/hodor
Minimalistic, simple and easy to use client side routing provider
https://github.com/alveflo/hodor
Last synced: 14 days ago
JSON representation
Minimalistic, simple and easy to use client side routing provider
- Host: GitHub
- URL: https://github.com/alveflo/hodor
- Owner: alveflo
- License: mit
- Created: 2014-11-01T12:08:21.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-09T15:45:41.000Z (about 10 years ago)
- Last Synced: 2023-08-04T01:03:41.856Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 223 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
hodor.js
======Minimalistic, simple and easy to use client side routing provider.
#### Usage
```html```
###### Note
This library utilizes ajax to load referred html pages. So in order to run this library you'll need to be backed up with a web server.
#### API
* `hodor.use(templateEngine)` specify a template engine.
* `hodor.use(path, file)` maps a path against a file
* `hodor.use(path, file, settings)` maps a path against a file and injects settings (used when templating)
* A div with attribute `data-hodor` is needed. This is where the views are injected!#### Dependencies
* [jQuery](http://jquery.com/)#### Example setup
```javascript
var app = new hodor();
app.use('/', 'main.htm');
app.use('/about', 'about.htm');
app.use('/contact', 'contact.htm');
```#### Setup with templating engine
hodor is supporting templating using [{{Mustache}}](https://github.com/janl/mustache.js) as template engine.
```javascript
var settings = {
Foo: 'Foo',
Bar: 'Bar',
};var app = new hodor();
app.use(Mustache);
app.use('/', 'main.html', settings);
app.use('/about', 'about.html', settings);
app.use('/contact', 'contact.html');
```#### Full example
```html
var app = new hodor();
app.use('/', 'main.htm');
app.use('/about', 'about.htm');
app.use('/contact', 'contact.htm');
```
#### Licence
The MIT License (MIT)