Skip to content

Instantly share code, notes, and snippets.

Created Nov 1, 2010
What would you like to do?
Play with Coffeescript / Sinatra
Install node.js:
# See:
cd ~/tmp && wget${NJSVERSION}.tar.gz && tar zxf node-${NJSVERSION}.tar.gz && cd node-${NJSVERSION}
./configure --prefix=/opt/node-${NJSVERSION} && make && make install && ln -s /opt/node-${NJSVERSION} /opt/node
ln -s /opt/node/bin/node ~/bin/node
vi .bashrc
export PATH=$PATH:/opt/node/bin
Install npm:
# See:
curl | sh
Install coffeescript:
# See:
/opt/node/bin/npm install coffee-script
Create your coffeescript app with sinatra:
gem install sinatra haml coffee-script
mkdir views
vi app.rb
require 'sinatra'
require 'haml'
require 'coffee_script'
get('/') {haml :hello}
get('/js'){coffee :hello}
vi views/
alert 'Hello world!'
vi views/hello.haml
%script(type="application/javascript" src="/js")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment