Skip to content

Commit e4031af

Browse files
committed
Load SCSS files into one combined application.css using Sprockets
1 parent 63e71c2 commit e4031af

File tree

14 files changed

+53
-52
lines changed

14 files changed

+53
-52
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ gem "sass"
1515
gem "redcarpet"
1616
gem "i18n", "~> 0.6.9"
1717
gem 'font-awesome-sass'
18+
gem 'sprockets'
1819

1920
group :development do
2021
gem "wrong", "~> 0.7.0"

Gemfile.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ GEM
2929
files (0.3.1)
3030
font-awesome-sass (4.2.0)
3131
sass (~> 3.2)
32+
hike (1.2.3)
3233
hitimes (1.2.2)
3334
i18n (0.6.11)
3435
json (1.8.1)
@@ -38,6 +39,7 @@ GEM
3839
rb-inotify (>= 0.9)
3940
mini_portile (0.6.0)
4041
minitest (5.4.1)
42+
multi_json (1.10.1)
4143
nokogiri (1.6.3.1)
4244
mini_portile (= 0.6.0)
4345
polyglot (0.3.5)
@@ -80,6 +82,11 @@ GEM
8082
rack (~> 1.4)
8183
rack-protection (~> 1.4)
8284
tilt (~> 1.3, >= 1.3.4)
85+
sprockets (2.11.0)
86+
hike (~> 1.2)
87+
multi_json (~> 1.0)
88+
rack (~> 1.0)
89+
tilt (~> 1.1, != 1.3.0)
8390
thin (1.6.2)
8491
daemons (>= 1.0.9)
8592
eventmachine (>= 1.0.0)
@@ -122,5 +129,6 @@ DEPENDENCIES
122129
rspec
123130
sass
124131
sinatra (~> 1.4.0)
132+
sprockets
125133
thin
126134
wrong (~> 0.7.0)

app.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
require "titleizer"
2323
require "asset_compiler"
2424
require "site"
25+
require 'sprockets'
2526

2627
class InstallFest < Sinatra::Application # todo: use Sinatra::Base instead, with more explicit config
2728
include Erector::Mixin
@@ -32,6 +33,9 @@ class InstallFest < Sinatra::Application # todo: use Sinatra::Base instead, wi
3233
# checking availability in dynamic locale assignment, they must be strings.
3334
AVAILABLE_LOCALES = DEFAULT_SITES.keys.map(&:to_s)
3435

36+
set :assets, Sprockets::Environment.new
37+
settings.assets.append_path "assets/stylesheets"
38+
3539
configure do
3640
I18n::Backend::Simple.include(I18n::Backend::Fallbacks)
3741
I18n.load_path = Dir[File.join(settings.root, 'locales', '*.yml')]
@@ -172,6 +176,11 @@ def render_deck
172176
halt 404
173177
end
174178

179+
get "/assets/:file.css" do
180+
content_type "text/css"
181+
settings.assets["#{params[:file]}.css"]
182+
end
183+
175184
get '/font-awesome.css' do
176185
content_type 'text/css'
177186
AssetCompiler.instance.font_awesome

assets/stylesheets/application.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//= require 'doc_page'
2+
//= require 'flags'
3+
//= require 'big_checkbox'
4+
//= require 'header'
5+
//= require 'toc'
6+
//= require 'step'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
$big_checkbox_size: 20px;
2+
3+
input.big_checkbox[type=checkbox] {
4+
display:none;
5+
+ label {
6+
height: $big_checkbox_size;
7+
width: $big_checkbox_size;
8+
display:inline-block;
9+
padding: 2px;
10+
margin: 0 12px -8px 0;
11+
background-color: white;
12+
z-index: 2;
13+
border: 2px solid #dadada;
14+
15+
&:hover {
16+
background-image: url(/img/check-dim.png);
17+
background-size: cover;
18+
cursor: pointer;
19+
}
20+
}
21+
22+
&:checked {
23+
+ label {
24+
background-image: url(/img/check.png);
25+
background-size: cover;
26+
}
27+
}
28+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)