This repository has been archived by the owner on Jun 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathconfig.rb
74 lines (59 loc) · 1.6 KB
/
config.rb
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
require_relative 'lib/lita_plugins'
config[:markdown] = { auto_ids: false } if config[:markdown].nil?
config[:sass_assets_paths].concat([
Bootstrap.stylesheets_path,
FontAwesome::Sass.stylesheets_path,
]) unless config[:sass_assets_paths].include?(Bootstrap.stylesheets_path)
page '/docs/index.html', layout: :docs_outer
page '/docs/*', layout: :docs
page '/plugins/*', layout: :plugins
page '/www/*', layout: :www
activate :directory_indexes
activate :lita_plugins
configure :server do
activate :livereload
end
configure :build do
activate :asset_hash
activate :asset_host, host: 'https://static.lita.io'
activate :minify_css
activate :minify_javascript
end
helpers do
def title_tag
data = current_page.data
title = if data.title
data.title
elsif data.guide && data.overview
data.guide
elsif data.guide
"#{data.guide}: #{data.section}"
else
'Documentation'
end
"#{title} - Lita.io"
end
def docs_link(text, url, options = {})
subsite_link("docs", text, url, options)
end
def plugins_link(text, url, options = {})
subsite_link("plugins", text, url, options)
end
def www_link(text, url, options = {})
subsite_link("www", text, url, options)
end
def icon(name, custom_class=nil)
content_tag(:i, class: "fa fa-#{name} #{custom_class}") { '' }
end
private
def subsite_link(subsite, text, url, options)
if url.start_with?("/")
if app.build?
url = File.join("https://#{subsite}.lita.io/", url)
else
url = File.join("/#{subsite}/", url)
end
end
link_to(text, url, options)
end
end