Skip to content

Instantly share code, notes, and snippets.

@wmnnd
Created September 5, 2014 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmnnd/cc481c9c78389ae18255 to your computer and use it in GitHub Desktop.
Save wmnnd/cc481c9c78389ae18255 to your computer and use it in GitHub Desktop.
require 'opal'
require 'sinatra'
$OPAL_APP_PATH = 'app'
map "/__opal_source_maps__" do
opal = Opal::Server.new {|s|
s.append_path $OPAL_APP_PATH
s.main = 'application'
}
run opal.source_maps
end
map '/assets/' do
env = Opal::Environment.new
env.append_path($OPAL_APP_PATH)
run env
end
get '/' do
<<-EOS
<!doctype html>
<html>
<head>
<script src="/assets/application.js"></script>
</head>
</html>
EOS
end
run Sinatra::Application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment