Sha256: 5b37cbe351a27ea511ba93519ab9656fefe323dcaedf7f9ecab7c5d1ac4bb85c
Contents?: true
Size: 1.15 KB
Versions: 6
Compression:
Stored size: 1.15 KB
Contents
require 'sinatra' require 'haml' require 'sass' require 'action_view' require 'sprockets' require_relative '../../app/helpers/stable_helper' include StableHelper set :assets, Sprockets::Environment.new settings.assets.append_path File.join(File.dirname(__FILE__), "../../app/assets/javascripts") settings.assets.append_path File.join(File.dirname(__FILE__), "../../app/assets/stylesheets") helpers do def render(*args) # HACK to load gem partial view if args.first.is_a?(Hash) && args.first.keys.include?(:partial) partial = args.first[:partial] location = File.join("../../../app/views", File.split(partial)[0], "_#{File.split(partial)[1]}") options = { :locals => args.last[:locals] } return haml location.to_sym, options else super end end end get '/' do haml :index end get "/javascripts/:file.js" do content_type "application/javascript" settings.assets["#{params[:file]}.js"] end get "/stylesheets/:file.css" do content_type "text/css" settings.assets["#{params[:file]}.css"] end get "/stylesheets/:part/:file.css" do content_type "text/css" settings.assets["#{params[:part]}/#{params[:file]}.css"] end
Version data entries
6 entries across 6 versions & 1 rubygems