UNPKG

661 BJavaScriptView Raw
1var html = require('choo/html')
2var css = require('sheetify')
3var choo = require('choo')
4
5css('tachyons')
6
7var app = choo()
8
9if (process.env.NODE_ENV === 'production') {
10 app.use(require('choo-service-worker')())
11} else {
12 app.use(require('choo-devtools')())
13}
14
15app.route('/', function (state, emit) {
16 emit('DOMTitleChange', 'hello planet')
17 return html`
18 <body class="sans-serif">
19 Hello planet
20 </body>
21 `
22})
23
24app.route('/other', function (state, emit) {
25 emit('DOMTitleChange', 'hello planet')
26 return html`
27 <body class="sans-serif">
28 Hello other
29 </body>
30 `
31})
32
33if (module.parent) module.exports = app
34else app.mount('body')