-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathconfig.rb
58 lines (46 loc) · 1.27 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
# Webrick was failing to long URIs coming from blockstack's authentication
require 'webrick'
::WEBrick::HTTPRequest.const_set("MAX_URI_LENGTH", 10240)
configure :development do
config[:host] = "http://localhost:3000"
end
configure :build do
config[:host] = "http://envelop.app"
activate :asset_hash,
exts: %w(.css .js),
ignore: [/\.worker\.js$/]
activate :minify_html
activate :gzip
end
# Per-page layout changes
page '/*.xml', layout: false
page '/*.json', layout: false
page '/*.txt', layout: false
# Include special files (Middleman ignores .dotfiles)
ready do
proxy '.well-known/assetlinks.json', 'well-known/assetlinks.json', ignore: true
end
# Helpers
helpers do
def placeholder_image_tag(options = {})
data_path = { path: '/' + config[:images_dir] }
if options[:data]
options[:data].merge!(data_path)
else
options.merge!({ data: data_path })
end
options[:src] = nil
image_tag(nil, options)
end
def image_url(*args)
File.join(config[:host], image_path(*args))
end
end
# Asset configuration
activate :external_pipeline,
name: :webpack,
command: build? ? "npm run build" : 'npm run start',
source: '.tmp/dist',
latency: 1
config[:assets_dir] = 'assets/javascripts'
config[:css_dir] = 'assets/stylesheets'