-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.rb
73 lines (57 loc) · 1.75 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
require "slim"
require "extensions/views"
::Slim::Engine.set_options pretty: true, format: :html
set :url_root, 'http://ownersup.com/free-trial'
set :relative_links, true
set :css_dir, 'css'
set :js_dir, 'js'
set :images_dir, 'images'
set :fonts_dir, 'fonts'
set :partials_dir, '_partials'
page "/faq/*/*", :layout => "article"
set :relative_links, true
set :markdown_engine, :redcarpet
set :markdown, :tables => true, :autolink => true, :gh_blockcode => true, :fenced_code_blocks => true, with_toc_data: true
activate :views
activate :directory_indexes
activate :search_engine_sitemap
activate :google_analytics do |ga|
ga.tracking_id = 'UA-65107405-5'
end
configure :development do
activate :livereload
end
configure :build do
activate :minify_css
activate :minify_javascript
activate :minify_html
# activate :asset_hash
# Compress and optimise images during build
# Documentation: https://github.com/plasticine/middleman-imageoptim
activate :imageoptim do |options|
# Image extensions to attempt to compress
options.image_extensions = %w(.png .jpg .gif .svg)
# Cause image_optim to be in shouty-mode
options.verbose = false
end
end
activate :deploy do |deploy|
deploy.build_before = true
deploy.method = :git
end
activate :bower
after_configuration do
sprockets.append_path File.join root.to_s, "vendor/assets/bower"
end
helpers do
def table_of_contents(resource)
content = File.read(resource.source_file)
content = content.gsub(/^(---\s*\n.*?\n?)^(---\s*$\n?)/m,'')
toc_renderer = Redcarpet::Render::HTML_TOC.new
markdown = Redcarpet::Markdown.new(toc_renderer, nesting_level: 1) # nesting_level is optional
html = markdown.render(content)
html.sub(/^<ul>/, '<ul class="nav">')
end
end
ready do
end