Sha256: 5db1359f6aa2adce115662bd6b47063ea9320e03aaccc5718e997b91fbc962bc

Contents?: true

Size: 736 Bytes

Versions: 29

Compression:

Stored size: 736 Bytes

Contents

require 'opal'
require 'sinatra'

opal = Opal::Server.new {|s|
  s.append_path 'app'
  s.main = 'application'
}

sprockets   = opal.sprockets
prefix      = '/assets'
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 prefix do
  run sprockets
end

get '/' do
  <<-HTML
    <!doctype html>
    <html>
      <head>
        <meta charset="utf-8">
        #{::Opal::Sprockets.javascript_include_tag('application', sprockets: sprockets, prefix: prefix, debug: true)}
      </head>
    </html>
  HTML
end

run Sinatra::Application

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
opal-0.11.4 examples/sinatra/config.ru
opal-0.11.3 examples/sinatra/config.ru
opal-0.11.2 examples/sinatra/config.ru
opal-0.11.1 examples/sinatra/config.ru
opal-0.11.1.pre examples/sinatra/config.ru
opal-0.10.6 examples/sinatra/config.ru
opal-0.10.6.beta examples/sinatra/config.ru
opal-0.11.0 examples/sinatra/config.ru
opal-0.10.5 examples/sinatra/config.ru
opal-0.10.4 examples/sinatra/config.ru
opal-0.11.0.rc1 examples/sinatra/config.ru
opal-0.10.3 examples/sinatra/config.ru
opal-0.10.2 examples/sinatra/config.ru
opal-0.10.1 examples/sinatra/config.ru
opal-0.10.0 examples/sinatra/config.ru
opal-0.10.0.rc2 examples/sinatra/config.ru
opal-0.9.4 examples/sinatra/config.ru
opal-0.9.3 examples/sinatra/config.ru
opal-0.10.0.rc1 examples/sinatra/config.ru
opal-0.10.0.beta5 examples/sinatra/config.ru