-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconfig.rb
More file actions
210 lines (169 loc) · 5.27 KB
/
config.rb
File metadata and controls
210 lines (169 loc) · 5.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
activate :dotenv
# This is the website version registered in Mixpanel
# It should match the minor version (e.g. 2.1) of the website
set :website_version, 2.3
Dir['lib/*.rb'].each { |file| require file }
###
# Compass
###
activate :directory_indexes
activate :meta_tags
set :url_root, 'https://craftacademy.se'
activate :search_engine_sitemap
# disable layout
page '.htaccess.apache', layout: false
# rename file after build
after_build do
File.rename 'build/.htaccess.apache', 'build/.htaccess'
end
# Change Compass configuration
# compass_config do |config|
# config.output_style = :compact
# end
###
# Page options, layouts, aliases and proxies
###
# Per-page layout changes:
#
# With no layout
# page "/path/to/file.html", layout: false
#
# With alternative layout
# page "/path/to/file.html", layout: :otherlayout
#
# A path which all have the same layout
# with_layout :admin do
# page "/admin/*"
# end
###
# Helpers
###
# Automatic image dimensions on image_tag helper
# activate :automatic_image_sizes
# Methods defined in the helpers block are available in templates
helpers CurrentPageHelper,
PartnerLogosHelper,
MarkdownHelper,
PossessiveHelper,
SlugHelper,
ImageHelper,
GraduatesHelper,
RawHelper,
StatsHelper
helpers do
def page_is_sa_homepage?
current_page.url == '/english/za/'
end
def current_page_is_sa?
current_page.url.match(/ pretoria|south-africa|za/)
end
def current_page_is_campaign_page?
current_page.url.match(/di-digital|stockholmer/)
end
def international_pages?
current_page.url.match(/international|pretoria|south-africa|za/)
end
end
# Proxy pages (https://middlemanapp.com/advanced/dynamic_pages/)
data.graduates.each do |grad|
if grad[:case_study]
url_slug = graduate_slug(grad)
proxy "/case-studies/#{url_slug}.html", '/case-studies/template.html', locals: { grad: grad }, ignore: true
end
end
data.graduates_en.each do |grad|
if grad[:case_study]
url_slug = graduate_slug(grad)
proxy "/english/students/#{url_slug}.html", '/english/case-studies/template.html', locals: { grad: grad }, ignore: true
end
end
page '/english/*', layout: 'en_layout'
set :css_dir, 'sass'
set :js_dir, 'javascripts'
set :partials_dir, 'partials'
set :images_dir, 'images'
sprockets.append_path File.join root, 'bower_components'
# set :apply_form_url, 'https://craftacademy.typeform.com/to/V4mFcd'
# set :apply_form_url_english, 'https://craftacademy.typeform.com/to/hkkxKQ'
# set :apply_sa_form_url, 'http://apply.thecraftacademy.co.za'
# set :hire_form_url, 'https://craftacademy.typeform.com/to/SQcaqh'
set :apply_form_url, 'https://form.jotform.com/213501220114029'
set :apply_form_url_english, 'https://form.jotform.com/213501220114029'
set :apply_sa_form_url, 'https://form.jotform.com/213501220114029'
set :hire_form_url, 'https://form.jotform.com/213501220114029'
set :class_site_url, 'http://learn.craftacademy.co'
# Ignore folders with unused templates
ignore 'elements/*'
ignore 'not_in_use/*'
# ignore 'case-studies/*' #as long as we don't present students
# Redirects from old site urls
redirect 'international.html', to: 'english/index.html'
redirect 'payments/new.html', to: config.apply_form_url
redirect 'apply.html', to: config.apply_form_url
redirect 'apply-for-ronin.html', to: config.apply_form_url
redirect 'blog.html', to: 'https://blog.craftacademy.se'
redirect 'pretoria.html', to: 'south-africa.html'
redirect 'south-africa.html', to: 'english/za/index.html'
# HACK: Comment this section out while in development
activate :deploy do |deploy|
deploy.method = :rsync
deploy.host = ENV.fetch('HOST')
deploy.path = ENV.fetch('DEPLOY_PATH')
deploy.user = ENV.fetch('DEPLOY_USER')
deploy.build_before = true
deploy.clean = true
end
# if ENV['RACK_ENV'] == 'production'
# activate :deploy do |deploy|
# deploy.method = :rsync
# deploy.host = ENV.fetch('HOST')
# deploy.path = ENV.fetch('DEPLOY_PATH')
# deploy.user = ENV.fetch('DEPLOY_USER')
# deploy.build_before = true
# deploy.clean = true
# end
# end
configure :development do
activate :livereload
# custom setting for switching off analytics in development
set :run_analytics, false
# turn on to view a baseline grid for setting vertical rhythm
set :show_baseline_grid, false
end
# Build-specific configuration
configure :build do
# activate :imageoptim do |options|
# options.pngout = false
# options.svgo = false
# end
# For example, change the Compass output style for deployment
activate :minify_css
# Minify Javascript on build
#activate :minify_javascript
# Enable cache buster
activate :asset_hash
# Use relative URLs
# activate :relative_assets
# Or use a different image path
# set :http_prefix, "/Content/images/"
set :run_analytics, true
set :show_baseline_grid, false
# Filewatcher ignore list
set :file_watcher_ignore, [
/^bin(\/|$)/,
/^\.bundle(\/|$)/,
# /^vendor(\/|$)/,
/^node_modules(\/|$)/,
/^\.sass-cache(\/|$)/,
/^\.cache(\/|$)/,
/^\.git(\/|$)/,
/^\.gitignore$/,
/\.DS_Store/,
/^\.rbenv-.*$/,
/^Gemfile$/,
/^Gemfile\.lock$/,
/~$/,
/(^|\/)\.?#/,
/^tmp\//
]
end