Skip to content

Instantly share code, notes, and snippets.

@davidpelaez
Created November 12, 2013 03:26
Show Gist options
  • Save davidpelaez/7424979 to your computer and use it in GitHub Desktop.
Save davidpelaez/7424979 to your computer and use it in GitHub Desktop.
Shows how to compile jade from ruby without node available in the system using binary gem the ruby racer, a V8 port for Ruby.
# Assuming you have jade's browserified version:
# as of the time of writing lives in: https://github.com/visionmedia/jade/blob/master/jade.js
#!/usr/bin/env ruby
puts "Compiling hellow world, expected output is <h1>Hellow world</h1>"
require 'rubygems'
require 'v8' #therubyracer
cxt = V8::Context.new
cxt.eval 'var window = {}'
cxt.load File.expand_path '../jade.js', __FILE__
puts cxt.eval 'window.jade.compile("h1 Hello World")()'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment