Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f2987f53004a
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 485400ecc319
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on May 4, 2015

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    d7aa45b View commit details
  2. Update sinatra example code wrt source maps

    fixes #716
    elia committed May 4, 2015

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    485400e View commit details
Showing with 14 additions and 3 deletions.
  1. +1 −0 examples/sinatra/Gemfile
  2. +13 −3 examples/sinatra/config.ru
1 change: 1 addition & 0 deletions examples/sinatra/Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source 'https://rubygems.org'

gem 'opal', :path => '../..'
gem 'thin' # webrick has a bug with safari
gem 'sinatra'
16 changes: 13 additions & 3 deletions examples/sinatra/config.ru
Original file line number Diff line number Diff line change
@@ -6,20 +6,30 @@ opal = Opal::Server.new {|s|
s.main = 'application'
}

map opal.source_maps.prefix do
run opal.source_maps
sprockets = opal.sprockets
maps_prefix = '/__OPAL_SOURCE_MAPS__'
maps_app = Opal::SourceMapServer.new(sprockets, maps_prefix)

# Monkeypatch sourcemap header support into sprockets
::Opal::Sprockets::SourceMapHeaderPatch.inject!(maps_prefix)

map maps_prefix do
run maps_app
end

map '/assets' do
run opal.sprockets
run sprockets
end

get '/' do
opal_boot_code = Opal::Processor.load_asset_code(sprockets, 'application')

<<-HTML
<!doctype html>
<html>
<head>
<script src="/assets/application.js"></script>
<script>#{opal_boot_code}</script>
</head>
</html>
HTML