Last active
August 29, 2015 14:04
-
-
Save enjalot/7cd061a66c61235de70b to your computer and use it in GitHub Desktop.
component-examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = module.exports = require('derby').createApp 'component-examples', __filename | |
app.serverUse module, 'derby-stylus' | |
app.loadViews __dirname | |
app.loadStyles __dirname | |
app.use require 'l-progress/example' | |
# add more components here... | |
app.get '/', -> | |
componentNames = [] | |
for viewName of app.views.nameMap | |
match = /^(l-.+)-example$/.exec viewName | |
componentNames.push match[1] if match | |
componentNames.sort (a,b) -> | |
return a.localeCompare(b) | |
@model.set '_page.componentNames', componentNames | |
@render 'home' | |
app.get '/:component', -> | |
@render @params.component + '-example' | |
app.on 'ready', (page) -> | |
# For debugging purposes only | |
window.MODEL = page.model | |
window.APP = app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Title:> | |
{{$render.ns}} Example | |
<Body:> | |
<view name={{$render.ns}}></view> | |
<home:> | |
<ul class="list"> | |
{{each _page.componentNames}} | |
<li><a href="/{{this}}">{{this}}</a></li> | |
{{/each}} | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@require './node_modules/l-progress' | |
.list | |
li | |
font-size: 25px | |
margin: 10px | |
padding: 10px | |
a | |
color: black | |
a:hover | |
color: blue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('derby-starter').run __dirname, {port: 3300} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment