-
-
Save seocahill/5397236 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler' | |
Bundler.require | |
# Helpers | |
class App < Sinatra::Base | |
set :root, File.dirname(__FILE__) | |
set :assets, Sprockets::Environment.new(root) | |
set :precompile, [ /\w+\.(?!js|css).+/, /application.(css|js)$/ ] | |
set :assets_prefix, '/assets' | |
set :digest_assets, false | |
set(:assets_path) { File.join public_folder, assets_prefix } | |
configure do | |
# Setup Sprockets | |
%w{javascripts stylesheets images}.each do |type| | |
assets.append_path "assets/#{type}" | |
assets.append_path Compass::Frameworks['bootstrap'].templates_directory + "/../vendor/assets/#{type}" | |
end | |
assets.append_path 'assets/font' | |
# Configure Sprockets::Helpers (if necessary) | |
Sprockets::Helpers.configure do |config| | |
config.environment = assets | |
config.prefix = assets_prefix | |
config.digest = digest_assets | |
config.public_path = public_folder | |
end | |
Sprockets::Sass.add_sass_functions = false | |
set :erb, { :format => :html5 } | |
end | |
before do | |
expires 500, :public, :must_revalidate | |
end | |
get '/' do | |
erb :index | |
end | |
helpers do | |
include Sprockets::Helpers | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "bootstrap"; | |
body { | |
padding-top: 80px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './swc_application' | |
use Rack::Cache, verbose: false | |
map App.assets_prefix do | |
run App.assets | |
end | |
map '/' do | |
run App | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
gem 'shotgun', group: :development | |
gem 'rack-cache' | |
gem 'sinatra', require: 'sinatra/base' | |
gem 'sinatra-support' | |
gem 'sprockets' | |
gem 'sprockets-helpers' | |
gem 'sprockets-sass' | |
gem 'compass' | |
gem 'bootstrap-sass' | |
gem 'coffee-script' | |
gem 'uglifier' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8" /> | |
<title> Sinatra, sprockets, compass, bootstrap-sass playing together</title> | |
<link href="application.css" rel="stylesheet" media="screen"> | |
<script src="application.js"></script> | |
</head> | |
<body> | |
<h1>Hello, world!</h1> | |
<script src="http://code.jquery.com/jquery.js"></script> | |
<script src="js/bootstrap.min.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment