Created
August 17, 2011 16:49
-
-
Save autotelicum/1151993 to your computer and use it in GitHub Desktop.
CoffeeKup HTML5 canvas template
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
# Template for CoffeeKup HTML5 document with canvas | |
kup = require 'coffeekup' | |
webpage = kup.render -> | |
doctype 5 | |
html -> | |
head -> | |
meta charset: 'utf-8' | |
title 'WEBPAGE' | |
style ''' | |
body {color: #F7C762; background-color: #202020} | |
''' | |
coffeescript -> | |
window.onload = -> | |
$ = (element) -> document.getElementById element | |
@canvas = $ 'canvas' | |
@context = canvas.getContext '2d' | |
unless @context? | |
alert 'No canvas in this browser. Please upgrade.' | |
return | |
# ... | |
return | |
body -> | |
div id: 'container', -> | |
canvas id: 'canvas', width: 340, height: 210 # Golden ratio | |
# ... | |
, format:on # Comment out to get unformatted HTML | |
# To generate HTML run command `coffee WEBPAGE.coffee` | |
(require 'fs').writeFileSync './WEBPAGE.html', webpage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment