-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.rb.template
197 lines (165 loc) · 5.47 KB
/
config.rb.template
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
################################################################################
# Paths
################################################################################
set :css_dir, 'assets/stylesheets'
set :fonts_dir, 'assets/fonts'
set :images_dir, 'assets/images'
set :js_dir, 'assets/javascripts'
set :partials_dir, 'partials'
set :url_root, 'http://lovehasnologic.com'
################################################################################
# Helpers
################################################################################
set :protocol, "http://"
set :host, "lovehasnologic.com"
set :port, 80
helpers do
def host_with_port
[host, optional_port].compact.join(':')
end
def optional_port
port unless port.to_i == 80
end
def image_url(source)
protocol + host_with_port + image_path(source)
end
def canonical_url
protocol + host_with_port + current_page.url
end
def svg_icon(icon, klass, width, height)
"<svg class='icon icon--#{icon} #{klass}' viewBox='0 0 #{width} #{height}'><use xlink:href='##{icon}'></use></svg>"
end
def lazy_image_tag(src, width, height, alt)
"<img data-original='#{src}' width='#{width}' height='#{height}' alt='#{alt}' />"
end
def copyright_year_range(start_year)
current_year = Time.current.year
if current_year > start_year
"#{start_year} - #{current_year}"
else
"#{start_year}"
end
end
end
################################################################################
# Blogs
################################################################################
activate :blog do |blog|
blog.name = "writing"
blog.prefix = "writing"
# blog.permalink = "{year}/{month}/{day}/{title}.html"
# blog.sources = "{year}-{month}-{day}-{title}.html"
# blog.taglink = "tags/{tag}.html"
# blog.layout = "layout"
# blog.summary_separator = /(READMORE)/
# blog.summary_length = 250
# blog.year_link = "{year}.html"
# blog.month_link = "{year}/{month}.html"
# blog.day_link = "{year}/{month}/{day}.html"
# blog.default_extension = ".markdown"
blog.tag_template = "tag.html"
blog.calendar_template = "calendar.html"
# blog.paginate = true
# blog.per_page = 10
# blog.page_link = "page/{num}"
end
activate :blog do |blog|
blog.name = "design"
blog.prefix = "design"
# blog.permalink = "{year}/{month}/{day}/{title}.html"
# blog.sources = "{year}-{month}-{day}-{title}.html"
# blog.taglink = "tags/{tag}.html"
# blog.layout = "layout"
# blog.summary_separator = /(READMORE)/
# blog.summary_length = 250
# blog.year_link = "{year}.html"
# blog.month_link = "{year}/{month}.html"
# blog.day_link = "{year}/{month}/{day}.html"
# blog.default_extension = ".markdown"
blog.tag_template = "tag.html"
blog.calendar_template = "calendar.html"
# blog.paginate = true
# blog.per_page = 10
# blog.page_link = "page/{num}"
end
page "/writing/feed.xml", layout: false
page "/design/feed.xml", layout: false
################################################################################
# Output
################################################################################
activate :directory_indexes
activate :gzip
activate :livereload
activate :search_engine_sitemap
activate :syntax
activate :autoprefixer do |config|
config.browsers = [
'> 2%',
'last 4 versions',
'Firefox >= 25',
'Android >= 4',
'Explorer >= 9',
'Opera >= 15',
'OperaMini >= 7']
config.cascade = false
end
activate :google_analytics do |ga|
ga.tracking_id = 'UA-12345678-1'
end
activate :i18n do |locale|
locale.langs = [:en]
locale.templates_dir = "templates"
end
activate :imageoptim do |options|
options.manifest = true
options.skip_missing_workers = true
options.verbose = false
options.nice = true
options.threads = true
options.allow_lossy = true
options.image_extensions = %w(.png .jpg .gif .svg)
options.advpng = { :level => 4 }
options.gifsicle = { :interlace => false }
options.jpegoptim = { :strip => ['all'], :max_quality => 90 }
options.jpegtran = { :copy_chunks => false, :progressive => true, :jpegrescan => true }
options.optipng = { :level => 6, :interlace => false }
options.pngcrush = { :chunks => ['alla'], :fix => false, :brute => false }
options.pngout = { :copy_chunks => false, :strategy => 0 }
options.svgo = {}
end
activate :minify_html do |html|
html.remove_input_attributes = false
end
activate :title do |title|
title.site = data.site.name
title.separator = ' | '
end
################################################################################
# Development
################################################################################
configure :development do
set :protocol, "http://"
set :host, "localhost"
set :port, 4567
end
################################################################################
# Build Settings
################################################################################
configure :build do
activate :minify_css
activate :minify_javascript
activate :asset_hash
activate :relative_assets
end
################################################################################
# Deployment
################################################################################
activate :deploy do |deploy|
deploy.method = :ftp
deploy.host = 'ftp.domain.com'
deploy.port = 21
deploy.path = '/path/to/html'
deploy.user = '[email protected]'
deploy.password = 'password'
deploy.build_before = true
end