-
-
Save eterps/658843 to your computer and use it in GitHub Desktop.
Play with Coffeescript / Sinatra
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
Install node.js: | |
# See: http://nodejs.org/#download | |
NJSVERSION=v0.2.4 | |
cd ~/tmp && wget http://nodejs.org/dist/node-${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: http://npmjs.org/ | |
curl http://npmjs.org/install.sh | sh | |
Install coffeescript: | |
# See: http://jashkenas.github.com/coffee-script/ | |
/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/hello.coffee | |
alert 'Hello world!' | |
vi views/hello.haml | |
%html | |
%head | |
%script(type="application/javascript" src="/js") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment