-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.rb
97 lines (78 loc) · 2.46 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# General config
# http://localhost:4567/__middleman
require 'builder' # Required for sitemap
# Import custom libraries and helpers
Dir['./*/*.rb'].each { |file| load file }
include FaviconsHelper
# Load Sass from node_modules
config[:sass_assets_paths] << File.join(root, 'node_modules')
set :css_dir, 'assets/css'
set :fonts_dir, 'assets/fonts'
set :images_dir, 'assets/images'
set :js_dir, 'assets/js'
# Activate and configure extensions
# https://middlemanapp.com/advanced/configuration/#configuring-extensions
activate :autoprefixer do |config|
config.browsers = 'last 2 versions'
end
activate :external_pipeline,
name: :webpack,
command: build? ? 'yarn run build' : 'yarn run start',
source: 'build',
latency: 1
activate :dotenv
activate :meta_tags
# Layouts
# https://middlemanapp.com/basics/layouts
page '/*.xml', layout: false
page '/*.json', layout: false
page '/*.txt', layout: false
page '/google8c054d702c2044e4.html', :layout => false
# With alternative layout
# page '/path/to/file.html', layout: 'other_layout'
# Proxy pages
# https://middlemanapp.com/advanced/dynamic-pages
# proxy(
# '/this-page-has-no-template.html',
# '/template-file.html',
# locals: {
# which_fake_page: 'Rendering a fake page with a local variable'
# }
# )
# Helpers
# Methods defined in the helpers block are available in templates
# https://middlemanapp.com/basics/helper-methods
# helpers do
# def some_helper
# 'Helping'
# end
# end
# Build-specific configuration
# https://middlemanapp.com/advanced/configuration/#environment-specific-settings
configure :development do
set :debug_assets, true
activate :livereload
activate :pry
end
configure :build do
ignore File.join(config[:js_dir], '*') # handled by webpack
set :asset_host, @app.data.site.host
set :relative_links, true
# Sitemap
set :url_root, @app.data.site.host
activate :search_engine_sitemap, default_priority: 0.5, default_change_frequency: "weekly"
# activate :asset_hash
#activate :favicon_maker, icons: generate_favicons_hash
# activate :gzip
activate :minify_css
activate :minify_html
activate :minify_javascript
activate :relative_assets
activate :robots, rules: [{ user_agent: '*', allow: %w[/] }],
sitemap: File.join(@app.data.site.host, 'sitemap.xml')
end
# activate :deploy do |deploy|
# deploy.deploy_method = :git
# deploy.branch = 'gh-pages'
# deploy.build_before = true
# end