fannypack 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.ruby-version +1 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +127 -0
- data/Guardfile +6 -0
- data/LICENSE +22 -0
- data/Procfile +1 -0
- data/README.md +166 -0
- data/Rakefile +50 -0
- data/config.rb +74 -0
- data/fannypack.gemspec +22 -0
- data/lib/assets/javascripts/fanny_pack.coffee +21 -0
- data/lib/assets/javascripts/fanny_pack/ajax.js.coffee +58 -0
- data/lib/assets/javascripts/fanny_pack/env.js.coffee +4 -0
- data/lib/assets/javascripts/fanny_pack/models/environment.js.coffee +15 -0
- data/lib/assets/javascripts/fanny_pack/namespace.coffee +10 -0
- data/lib/assets/javascripts/fanny_pack/routers/base.coffee +82 -0
- data/lib/assets/javascripts/fanny_pack/version.js.coffee +2 -0
- data/lib/assets/javascripts/fanny_pack/views/app.coffee +19 -0
- data/lib/assets/javascripts/fanny_pack/views/base.coffee +90 -0
- data/lib/assets/javascripts/fanny_pack/views/list.coffee +29 -0
- data/lib/fanny_pack.rb +4 -0
- data/lib/fanny_pack/assets.rb +24 -0
- data/lib/fanny_pack/version.rb +4 -0
- data/source/images/background.png +0 -0
- data/source/images/middleman.png +0 -0
- data/source/index.html.haml +9 -0
- data/source/javascripts/application.js.coffee +2 -0
- data/source/javascripts/lib/.gitkeep +0 -0
- data/source/javascripts/vendor/.gitkeep +0 -0
- data/source/layouts/layout.html.haml +49 -0
- data/source/stylesheets/application.css.sass +2 -0
- data/source/stylesheets/lib/_fonts.css.sass +0 -0
- data/source/stylesheets/lib/_mixins.css.sass +0 -0
- data/source/stylesheets/lib/_variables.css.sass +0 -0
- data/source/stylesheets/lib/common.css.sass +1 -0
- data/source/stylesheets/vendor/all.css +55 -0
- data/source/stylesheets/vendor/normalize.css +375 -0
- data/spec/javascripts/helpers/spec_helper.coffee +11 -0
- data/spec/javascripts/support/jasmine-jquery.js +812 -0
- data/spec/javascripts/support/jasmine-sinon.coffee +246 -0
- data/spec/javascripts/support/jasmine.yml +10 -0
- data/spec/javascripts/support/jasmine_helper.rb +3 -0
- data/spec/javascripts/support/sinon-1.7.3.js +4290 -0
- data/spec/javascripts/views/base_spec.coffee +130 -0
- data/spec/javascripts/views/list_spec.coffee +31 -0
- data/vendor/assets/javascripts/backbone-1.1.2.js +1608 -0
- data/vendor/assets/javascripts/jquery-1.11.0.js +10337 -0
- data/vendor/assets/javascripts/json2.js +487 -0
- data/vendor/assets/javascripts/ppx.js +391 -0
- data/vendor/assets/javascripts/underscore-1.5.1.js +1246 -0
- data/vendor/assets/javascripts/uri.js +1803 -0
- data/vendor/assets/javascripts/zepto-detect.js +66 -0
- metadata +150 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ec77acdd5b07e0af9a1dafea7e729073fdd183f9
|
4
|
+
data.tar.gz: aebeed7dbbef0d2161fbfc386a61449c69955c22
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 973bab2d78627bad9f42bf97745eb1c7ee4ed68db4c15355bfc2084a3ddc5872e210b6a6db2383de621f5fc698be5f43e29e7c572b024144ba3c980ca5117bb1
|
7
|
+
data.tar.gz: 96efa165e8112e7c9f8df0a3a9be59e1d07c03e0be8435243c3d370b420f9a2f9fb99ee026c02dc50b70ad4708cab248b212ecfd5e73b2fcedd9cfb29ae24671
|
data/.gitignore
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
6
|
+
|
7
|
+
# Ignore bundler config
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the build directory
|
11
|
+
/build
|
12
|
+
|
13
|
+
# Ignore Sass' cache
|
14
|
+
/.sass-cache
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0-p451
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fannypack (0.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activesupport (4.0.4)
|
10
|
+
i18n (~> 0.6, >= 0.6.9)
|
11
|
+
minitest (~> 4.2)
|
12
|
+
multi_json (~> 1.3)
|
13
|
+
thread_safe (~> 0.1)
|
14
|
+
tzinfo (~> 0.3.37)
|
15
|
+
chunky_png (1.3.0)
|
16
|
+
coffee-script (2.2.0)
|
17
|
+
coffee-script-source
|
18
|
+
execjs
|
19
|
+
coffee-script-source (1.7.0)
|
20
|
+
compass (0.12.6)
|
21
|
+
chunky_png (~> 1.2)
|
22
|
+
fssm (>= 0.2.7)
|
23
|
+
sass (~> 3.2.19)
|
24
|
+
compass-import-once (1.0.4)
|
25
|
+
sass (>= 3.2, < 3.5)
|
26
|
+
erubis (2.7.0)
|
27
|
+
execjs (2.0.2)
|
28
|
+
ffi (1.9.3)
|
29
|
+
fssm (0.2.10)
|
30
|
+
growl (1.0.3)
|
31
|
+
haml (4.0.5)
|
32
|
+
tilt
|
33
|
+
hike (1.2.3)
|
34
|
+
hooks (0.4.0)
|
35
|
+
uber (~> 0.0.4)
|
36
|
+
i18n (0.6.9)
|
37
|
+
jasmine (2.0.1)
|
38
|
+
jasmine-core (~> 2.0.0)
|
39
|
+
phantomjs
|
40
|
+
rack (>= 1.2.1)
|
41
|
+
rake
|
42
|
+
jasmine-core (2.0.0)
|
43
|
+
json (1.8.1)
|
44
|
+
kramdown (1.3.3)
|
45
|
+
listen (1.3.1)
|
46
|
+
rb-fsevent (>= 0.9.3)
|
47
|
+
rb-inotify (>= 0.9)
|
48
|
+
rb-kqueue (>= 0.2)
|
49
|
+
middleman (3.3.2)
|
50
|
+
coffee-script (~> 2.2.0)
|
51
|
+
compass (>= 0.12.4)
|
52
|
+
compass-import-once (~> 1.0.4)
|
53
|
+
execjs (~> 2.0)
|
54
|
+
haml (>= 4.0.5)
|
55
|
+
kramdown (~> 1.2)
|
56
|
+
middleman-core (= 3.3.2)
|
57
|
+
middleman-sprockets (>= 3.1.2)
|
58
|
+
sass (>= 3.2.17, < 4.0)
|
59
|
+
uglifier (~> 2.5)
|
60
|
+
middleman-core (3.3.2)
|
61
|
+
activesupport (~> 4.0.1)
|
62
|
+
bundler (~> 1.1)
|
63
|
+
erubis
|
64
|
+
hooks (~> 0.3)
|
65
|
+
i18n (~> 0.6.9)
|
66
|
+
listen (~> 1.1)
|
67
|
+
padrino-helpers (~> 0.12.1)
|
68
|
+
rack (>= 1.4.5, < 2.0)
|
69
|
+
rack-test (~> 0.6.2)
|
70
|
+
thor (>= 0.15.2, < 2.0)
|
71
|
+
tilt (~> 1.4.1, < 2.0)
|
72
|
+
middleman-jasmine (0.5.0)
|
73
|
+
jasmine (~> 2.0.0)
|
74
|
+
middleman (~> 3.3.2)
|
75
|
+
middleman-sprockets (3.3.3)
|
76
|
+
middleman-core (>= 3.2)
|
77
|
+
sprockets (~> 2.2)
|
78
|
+
sprockets-helpers (~> 1.1.0)
|
79
|
+
sprockets-sass (~> 1.1.0)
|
80
|
+
minitest (4.7.5)
|
81
|
+
multi_json (1.9.2)
|
82
|
+
padrino-helpers (0.12.1)
|
83
|
+
i18n (~> 0.6, >= 0.6.7)
|
84
|
+
padrino-support (= 0.12.1)
|
85
|
+
tilt (~> 1.4.1)
|
86
|
+
padrino-support (0.12.1)
|
87
|
+
activesupport (>= 3.1)
|
88
|
+
phantomjs (1.9.7.0)
|
89
|
+
rack (1.5.2)
|
90
|
+
rack-test (0.6.2)
|
91
|
+
rack (>= 1.0)
|
92
|
+
rake (10.3.1)
|
93
|
+
rb-fsevent (0.9.3)
|
94
|
+
rb-inotify (0.9.3)
|
95
|
+
ffi (>= 0.5.0)
|
96
|
+
rb-kqueue (0.2.2)
|
97
|
+
ffi (>= 0.5.0)
|
98
|
+
sass (3.2.19)
|
99
|
+
sprockets (2.12.1)
|
100
|
+
hike (~> 1.2)
|
101
|
+
multi_json (~> 1.0)
|
102
|
+
rack (~> 1.0)
|
103
|
+
tilt (~> 1.1, != 1.3.0)
|
104
|
+
sprockets-helpers (1.1.0)
|
105
|
+
sprockets (~> 2.0)
|
106
|
+
sprockets-sass (1.1.0)
|
107
|
+
sprockets (~> 2.0)
|
108
|
+
tilt (~> 1.1)
|
109
|
+
thor (0.19.1)
|
110
|
+
thread_safe (0.3.3)
|
111
|
+
tilt (1.4.1)
|
112
|
+
tzinfo (0.3.39)
|
113
|
+
uber (0.0.4)
|
114
|
+
uglifier (2.5.0)
|
115
|
+
execjs (>= 0.3.0)
|
116
|
+
json (>= 1.8.0)
|
117
|
+
|
118
|
+
PLATFORMS
|
119
|
+
ruby
|
120
|
+
|
121
|
+
DEPENDENCIES
|
122
|
+
fannypack!
|
123
|
+
growl
|
124
|
+
jasmine (~> 2.0.0)
|
125
|
+
middleman (~> 3.3)
|
126
|
+
middleman-jasmine
|
127
|
+
rb-fsevent
|
data/Guardfile
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
spec_location = "spec/javascripts/%s_spec"
|
2
|
+
|
3
|
+
guard 'jasmine-headless-webkit', :all_on_start => false do
|
4
|
+
watch(%r{^source/javascripts/(.*)\.(js|coffee)$}) { |m| newest_js_file(spec_location % m[1]) }
|
5
|
+
watch(%r{^spec/javascripts/(.*)_spec\..*}) { |m| newest_js_file(spec_location % m[1]) }
|
6
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Poll Everywhere
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/Procfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
web: bundle exec middleman server -p $PORT
|
data/README.md
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
# fanny-pack
|
2
|
+
|
3
|
+
Base classes for building Backbone applications that you shouldn't leave home without.
|
4
|
+
|
5
|
+
## Documentation
|
6
|
+
|
7
|
+
**Namespacing**: JavaScript doesn’t have a native namespace language feature. We use a simple function to do our namespacing. We even put it on our PollEv object to avoid with other possible namespace implementations.
|
8
|
+
|
9
|
+
```coffee
|
10
|
+
FannyPack.namespace 'MyApp.View', (View) ->
|
11
|
+
class View.PollWidget extends FannyPack.View.Base
|
12
|
+
show: ->
|
13
|
+
hide: ->
|
14
|
+
```
|
15
|
+
**Router/Application/EventBus**: FannyPack applications are Backbone routers and use the router as an eventBus. Your application should consist of 1 router that lives at ```FannyPack.app```. All FannyPack base views are aware of the application at ```FannyPack.app```. FannyPack also comes with its own base view which takes care of rendering views. You can override the default behavior to introduce transitions.
|
16
|
+
|
17
|
+
```coffee
|
18
|
+
# A sample FannyPack application router
|
19
|
+
class MyApp extends FannyPack.Router.Base
|
20
|
+
routes:
|
21
|
+
"": "index"
|
22
|
+
|
23
|
+
index: =>
|
24
|
+
view = new View.Index
|
25
|
+
|
26
|
+
# @view view is the routers own view. Call `activate` to replace the existing rendered view with the new view
|
27
|
+
@view.activate view
|
28
|
+
|
29
|
+
# This goes in your application.html
|
30
|
+
$ ->
|
31
|
+
FannyPack.app = new MyApp().start
|
32
|
+
pushState: true # Enable if you want to start Backbone.history with pushState
|
33
|
+
el: $('body') # The is the element the router will attach its application view to
|
34
|
+
```
|
35
|
+
|
36
|
+
**Base Class**: The base class can’t infer the current application you’re working on, so you need to define a base class for your application that all your views will inherit from.
|
37
|
+
|
38
|
+
```coffee
|
39
|
+
FannyPack.namespace 'MyApp.View', (View) ->
|
40
|
+
# set up an application specific base view that
|
41
|
+
# inherits from our FannyPack base view
|
42
|
+
class View.Base extends FannyPack.View.Base
|
43
|
+
```
|
44
|
+
|
45
|
+
**Templates**: We use [haml\_coffee\_assets](https://github.com/netzpirat/haml_coffee_assets) for our templating.
|
46
|
+
|
47
|
+
`FannyPack.Base#template` resolves the path to your templates relative to your application. First create a .hamlc file in your templates directory (eg. in viz: lib/assets/javascripts/my_app/templates/header.hamlc)
|
48
|
+
|
49
|
+
Then, make sure to require it with sprockets.
|
50
|
+
|
51
|
+
```coffee
|
52
|
+
# FannyPack.Base#renderTemplate usage
|
53
|
+
|
54
|
+
#= require my_app/templates/view
|
55
|
+
|
56
|
+
FannyPack.namespace "MyApp.View", (View) ->
|
57
|
+
class View.Header extends View.Base
|
58
|
+
render: =>
|
59
|
+
{
|
60
|
+
headerLogoPlacement
|
61
|
+
headerLogoUrl
|
62
|
+
} = @model.flashOptions().attributes
|
63
|
+
|
64
|
+
@$el.html @renderTemplate 'chart_header',
|
65
|
+
title: @model.get('title')
|
66
|
+
headerPlacement: headerLogoPlacement
|
67
|
+
headerLogoUrl: headerLogoUrl
|
68
|
+
|
69
|
+
return @
|
70
|
+
```
|
71
|
+
|
72
|
+
Note: Since launching HTML charts we've decided to start practicing 'logic-less' templates. That is, we aren't going to pass variables into to templates or use any control flow inside them. They will simply be used to insert markup into the DOM. Any dynamic hiding, or updating text will occur in view methods (this makes re-rendering individual pieces much easier and makes it easier to optimize performance in slow browsers).
|
73
|
+
|
74
|
+
**Events**: In addition to the standard event bindings that Backbone sets up for views, we use an eventBus pattern that allows any view to trigger an application specific custom event that other views can listen to. This is better for testing and refactoring than passing hard dependencies into each view’s constructor. You should try to keep all interaction within the appropriate view but sometimes outside or coordinating views need to respond to things happening within subviews.
|
75
|
+
|
76
|
+
```coffee
|
77
|
+
# FannyPack.Base#triggerEvent usage
|
78
|
+
|
79
|
+
FannyPack.namespace 'MyApp.View', (View) ->
|
80
|
+
class View.Header extends View.Base
|
81
|
+
toggle: =>
|
82
|
+
@$el.toggle()
|
83
|
+
|
84
|
+
# send the 'header:toggle' event to any view that is listening
|
85
|
+
# passing them a boolean of whether the current view is hidden
|
86
|
+
@app.trigger 'header:toggle', @$el.hasClass('hidden')
|
87
|
+
|
88
|
+
class View.Body extends View.Base
|
89
|
+
appEvents:
|
90
|
+
'header:toggle': 'resize'
|
91
|
+
|
92
|
+
# this is called whenever ChartHeader or any other view
|
93
|
+
# triggers 'header:toggle'
|
94
|
+
resize: =>
|
95
|
+
@measureBars()
|
96
|
+
@render()
|
97
|
+
```
|
98
|
+
|
99
|
+
**Modules**: Use modules to break up large classes that have repeated behaviors or just to isolate related behavior. Call include in the class declaration to include other modules.
|
100
|
+
|
101
|
+
```coffee
|
102
|
+
# FannyPack.Base#include usage
|
103
|
+
|
104
|
+
FannyPack.namespace 'MyApp.View' (View) ->
|
105
|
+
View.MyModule = (self) ->
|
106
|
+
eat: ->
|
107
|
+
'mmm'
|
108
|
+
|
109
|
+
sleep: ->
|
110
|
+
'zzz'
|
111
|
+
|
112
|
+
breathe: ->
|
113
|
+
'*silent*'
|
114
|
+
|
115
|
+
getModel: ->
|
116
|
+
self.model
|
117
|
+
|
118
|
+
FannyPack.namespace 'MyApp.View', (View) ->
|
119
|
+
class View.Person extends View.Base
|
120
|
+
initialize: ->
|
121
|
+
@include View.MyModule
|
122
|
+
|
123
|
+
view = new MyApp.View.Person
|
124
|
+
model: new Backbone.Model
|
125
|
+
|
126
|
+
# view now has all these methods
|
127
|
+
view.eat() # => 'mmm'
|
128
|
+
view.sleep() # => 'zzz'
|
129
|
+
view.breathe() # => '*silent*'
|
130
|
+
|
131
|
+
view.getModel() # => Backbone.Model
|
132
|
+
```
|
133
|
+
|
134
|
+
**Memory Management and listening to model events**: Usually Backbone Views are a huge pain to manage in terms of leaking events and memory. FannyPack deals with memory management for you.
|
135
|
+
|
136
|
+
```coffee
|
137
|
+
# FannyPack.Base#include usage
|
138
|
+
|
139
|
+
FannyPack.namespace 'MyApp.View' (View) ->
|
140
|
+
class View.DontLeak extends View.Base
|
141
|
+
appEvents:
|
142
|
+
'otherView:update': 'render'
|
143
|
+
|
144
|
+
events:
|
145
|
+
'click': 'respondToClick'
|
146
|
+
|
147
|
+
initialize: ->
|
148
|
+
# set up your view to listen on change events
|
149
|
+
# emitted from the passed in @model
|
150
|
+
@listenTo @model, 'change', (model, attributes) =>
|
151
|
+
# Do stuff
|
152
|
+
|
153
|
+
render: =>
|
154
|
+
# ...
|
155
|
+
|
156
|
+
respondToClick: (e) ->
|
157
|
+
# ...
|
158
|
+
|
159
|
+
view = new View.DontLeak
|
160
|
+
model: new Backbone.Model
|
161
|
+
|
162
|
+
# FannyPack unbinds all model events set up with listenOn,
|
163
|
+
# all jQuery events, all external events and removes the
|
164
|
+
# view element from the DOM
|
165
|
+
view.remove()
|
166
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
namespace :jasmine do
|
4
|
+
task :configure do
|
5
|
+
require 'jasmine/config'
|
6
|
+
|
7
|
+
begin
|
8
|
+
Jasmine.load_configuration_from_yaml(ENV['JASMINE_CONFIG_PATH'])
|
9
|
+
rescue Jasmine::ConfigNotFound => e
|
10
|
+
puts e.message
|
11
|
+
exit 1
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
task :require do
|
16
|
+
require 'jasmine'
|
17
|
+
end
|
18
|
+
|
19
|
+
task :require_json do
|
20
|
+
begin
|
21
|
+
require 'json'
|
22
|
+
rescue LoadError
|
23
|
+
puts "You must have a JSON library installed to run jasmine:ci. Try \"gem install json\""
|
24
|
+
exit
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'Run continuous integration tests'
|
29
|
+
task :ci => %w(jasmine:require_json jasmine:require jasmine:configure) do
|
30
|
+
config = Jasmine.config
|
31
|
+
|
32
|
+
pid = spawn "foreman start -p #{config.port(:ci)}"
|
33
|
+
|
34
|
+
sleep 5
|
35
|
+
|
36
|
+
formatters = config.formatters.map { |formatter_class| formatter_class.new }
|
37
|
+
|
38
|
+
exit_code_formatter = Jasmine::Formatters::ExitCode.new
|
39
|
+
formatters << exit_code_formatter
|
40
|
+
|
41
|
+
url = "#{config.host}:#{config.port(:ci)}/specs/jasmine"
|
42
|
+
runner = config.runner.call(Jasmine::Formatters::Multi.new(formatters), url)
|
43
|
+
runner.run
|
44
|
+
|
45
|
+
break unless exit_code_formatter.succeeded?
|
46
|
+
|
47
|
+
Process.kill "TERM", pid
|
48
|
+
exit
|
49
|
+
end
|
50
|
+
end
|
data/config.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
###
|
2
|
+
# Compass
|
3
|
+
###
|
4
|
+
|
5
|
+
# Susy grids in Compass
|
6
|
+
# First: gem install susy
|
7
|
+
# require 'susy'
|
8
|
+
|
9
|
+
# Change Compass configuration
|
10
|
+
# compass_config do |config|
|
11
|
+
# config.output_style = :compact
|
12
|
+
# end
|
13
|
+
|
14
|
+
###
|
15
|
+
# Page options, layouts, aliases and proxies
|
16
|
+
###
|
17
|
+
|
18
|
+
# Per-page layout changes:
|
19
|
+
#
|
20
|
+
# With no layout
|
21
|
+
# page "/path/to/file.html", :layout => false
|
22
|
+
#
|
23
|
+
# With alternative layout
|
24
|
+
# page "/path/to/file.html", :layout => :otherlayout
|
25
|
+
#
|
26
|
+
# A path which all have the same layout
|
27
|
+
# with_layout :admin do
|
28
|
+
# page "/admin/*"
|
29
|
+
# end
|
30
|
+
|
31
|
+
# Proxy (fake) files
|
32
|
+
# page "/this-page-has-no-template.html", :proxy => "/template-file.html" do
|
33
|
+
# @which_fake_page = "Rendering a fake page with a variable"
|
34
|
+
# end
|
35
|
+
|
36
|
+
###
|
37
|
+
# Helpers
|
38
|
+
###
|
39
|
+
|
40
|
+
# Automatic image dimensions on image_tag helper
|
41
|
+
# activate :automatic_image_sizes
|
42
|
+
|
43
|
+
# Methods defined in the helpers block are available in templates
|
44
|
+
# helpers do
|
45
|
+
# def some_helper
|
46
|
+
# "Helping"
|
47
|
+
# end
|
48
|
+
# end
|
49
|
+
|
50
|
+
set :css_dir, 'stylesheets'
|
51
|
+
|
52
|
+
set :js_dir, 'javascripts'
|
53
|
+
|
54
|
+
set :images_dir, 'images'
|
55
|
+
|
56
|
+
activate :jasmine, jasmine_url: "/specs/jasmine"
|
57
|
+
|
58
|
+
# Build-specific configuration
|
59
|
+
configure :build do
|
60
|
+
ignore 'images/*.psd'
|
61
|
+
ignore 'stylesheets/lib/*'
|
62
|
+
ignore 'stylesheets/vendor/*'
|
63
|
+
ignore 'javascripts/lib/*'
|
64
|
+
ignore 'javascripts/vendor/*'
|
65
|
+
|
66
|
+
# For example, change the Compass output style for deployment
|
67
|
+
activate :minify_css
|
68
|
+
|
69
|
+
# Minify Javascript on build
|
70
|
+
activate :minify_javascript
|
71
|
+
|
72
|
+
# Fingerprint assets
|
73
|
+
activate :asset_hash, :exts => %w(.jpg .jpeg .png .gif .js .css .hamljs .hamlc .eot .svg .ttf .woff)
|
74
|
+
end
|