Aurelia and JSPM – A match made in heaven

JSPM is awesome. To show how amazingly easy it is here is the worlds’ shortest tutorial –

Starter code

Grab the aurelia/skeleton-navigation repo.

git clone https://github.com/aurelia/skeleton-navigation.git

Install the dependencies listed there (npm install -g gulp, npm install -g jspm, npm install, then jspm install)

Now our base app is functional.

Add a new dependency from NPM

For this example let’s choose everyone’s favorite formatter – `markdown` – from npm –

jspm install npm:markdown

Use it

In the welcome.js view model add this import at the top –

import markdown from 'markdown'

And use the tool –

console.log(markdown.toHTML(''));

That’s it!

Few notes on JSPM install –

jspm install npm:markdown <~ tells jspm to install the package from npm named markdown. This allows us to import from markdown; without having to specify the exact path when using JSPM’s partner in crime, system.js.