-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.rb
68 lines (52 loc) · 1.84 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
# Activate and configure extensions
# https://middlemanapp.com/advanced/configuration/#configuring-extensions
activate :directory_indexes
activate :i18n, mount_at_root: :en
activate :external_pipeline,
name: :webpack,
command: build? ? 'yarn run build' : 'yarn run start',
source: '.tmp/dist',
latency: 1
config[:js_dir] = 'assets/javascripts'
config[:css_dir] = 'assets/stylesheets'
# Layouts
# https://middlemanapp.com/basics/layouts/
# Per-page layout changes
page '/*.xml', layout: false
page '/*.json', layout: false
page '/*.txt', layout: false
# With alternative layout
# page '/path/to/file.html', layout: 'other_layout'
# Proxy pages
# https://middlemanapp.com/advanced/dynamic-pages/
available_locales = %w[ar bg ca cs da de el es en eo et eu fi fr ga hr hu it lb lt lv mt nl oc pl pt ro ru sc sk sl sv tr]
available_locales.each do |locale|
next if locale == :en
proxy "/#{locale}/index.html", "localizable/index.html"
%w[act contact organizations press].each do |slug|
proxy "/#{locale}/#{slug}/index.html", "localizable/#{slug}/index.html"
end
end
# Helpers
# Methods defined in the helpers block are available in templates
# https://middlemanapp.com/basics/helper-methods/
helpers do
def nice_url(url)
uri = URI.parse(url)
"#{uri.host.gsub('www.', '')}#{uri.path.chomp('/')}"
end
end
# Build-specific configuration
# https://middlemanapp.com/advanced/configuration/#environment-specific-settings
configure :development do
set :debug_assets, true
activate :livereload
end
configure :build do
ignore File.join(config[:js_dir], '*') # handled by webpack
ignore File.join(config[:css_dir], '*') # handled by webpack
activate :asset_hash
activate :minify_html
# activate :robots, rules: [{ user_agent: '*', allow: %w[/] }],
# sitemap: File.join(@app.data.site.host, 'sitemap.xml')
end