preview/app.rb in dvl-flashes-0.0.3 vs preview/app.rb in dvl-flashes-0.0.4
- old
+ new
@@ -1,29 +1,30 @@
require 'sinatra/base'
-require 'sinatra/assetpack'
+require 'sinatra/asset_pipeline'
require 'active_support/all'
require 'erector'
require 'dvl/flashes'
+require 'dvl/core'
class App < Sinatra::Base
set :root, File.dirname(__FILE__)
+ set :assets_prefix, [
+ 'vendor/assets',
+ "#{Gem::Specification.find_by_name("dvl-core").gem_dir}/vendor/assets"
+ ]
- register Sinatra::AssetPack
+ register Sinatra::AssetPipeline
- assets do
- serve '/js', from: '../vendor/assets/javascripts'
- serve '/css', from: '../vendor/assets/stylesheets'
- end
-
get '/' do
Erector.inline {
rawtext '<!doctype html>'
html {
head {
- link href: '/css/dvl/flashes.css', rel: 'stylesheet', type: 'text/css', media: 'all'
- style '* {box-sizing:border-box;}'.html_safe, type: 'text/css'
+ link href: '//fonts.googleapis.com/css?family=Open+Sans:400,300,700,600', rel: 'stylesheet', type: 'text/css'
+ link href: '/assets/dvl/core.css', rel: 'stylesheet', type: 'text/css', media: 'all'
+ link href: '/assets/dvl/flashes.css', rel: 'stylesheet', type: 'text/css', media: 'all'
}
body {
# Uncomment to test rendering from existing HTML
# widget Dvl::Flashes::Views::Flashes.new(flash: { success: 'You did it!' })
@@ -38,10 +39,11 @@
a 'Error', href: 'javascript:DvlFlash("error", "Oh no, an error occured!")'
}
}
script src: '//code.jquery.com/jquery-1.11.1.min.js'
- script src: '/js/dvl/flashes.js'
+ script src: '/assets/dvl/core.js'
+ script src: '/assets/dvl/flashes.js'
}
}
}.to_html
end