-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.rb
More file actions
executable file
·47 lines (39 loc) · 1.42 KB
/
Copy pathconfig.rb
File metadata and controls
executable file
·47 lines (39 loc) · 1.42 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
Dir['./*/*.rb'].each { |file| load file }
# Build-specific configuration
# https://middlemanapp.com/advanced/configuration/#environment-specific-settings
set :url_root, @app.data.site.host
activate :external_pipeline,
name: :tailwindcss,
command: build? ? 'tailwindcss -i source/stylesheets/tailwind.css -o source/stylesheets/site.css --minify' : 'tailwindcss -i source/stylesheets/tailwind.css -o source/stylesheets/site.css --watch --minify',
source: 'source',
latency: 1
activate :livereload
activate :i18n,
mount_at_root: :en,
lang_map: { fr: :acp, de: :solawi }
configure :development do
set :debug_assets, true
end
configure :build do
set :asset_host, @app.data.site.host
set :relative_links, true
activate :asset_hash, ignore: %w[images/logo.png]
activate :directory_indexes
activate :gzip
activate :relative_assets
activate :robots,
rules: [{ user_agent: '*', allow: %w[/] }],
sitemap: File.join(@app.data.site.host, 'sitemap.xml')
end
activate :inline_svg
helpers do
def current_page?(path)
current_page.url.chomp('/') == path.chomp('/')
end
def locale_link_to(text, path, options = {})
path = "#{path}/" unless path.end_with?('/')
# Avoid link_to: Middleman i18n rewrites /solawi/ to the current locale.
href = build? ? "#{data.site.host}#{path}" : path
content_tag(:a, text, options.merge(href: href))
end
end