forked from flynn/flynn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.rb
75 lines (57 loc) · 1.74 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
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
# Reload the browser automatically whenever files change
begin
require 'middleman-livereload'
activate :livereload
rescue LoadError
end
helpers do
def active_nav_class(path, opts={})
current = current_path.sub(/\.html\Z/, '').sub(/\/index\Z/, '')
path = full_path(path).sub(/\A\//, '').sub(/\.html\Z/, '').sub(/\/index\Z/, '')
if opts[:not] && opts[:not].match(current)
return ""
end
r = Regexp.new("\\A#{Regexp.escape(path)}")
r.match(current) ? "active" : ""
end
def nav_link_with_active(text, target, attributes = {})
target_path = full_path(target).sub(/\A\//, '').sub(/\.html\Z/, '')
item_path = current_path.sub(/\.html\Z/, '')
active = if attributes.delete(:top)
/\A#{target_path}/ =~ item_path
else
target_path == item_path
end
"<li #{'class="active"' if active}>" + link_to(text, target, attributes) + "</li>"
end
end
require 'builder'
require 'markdown_html'
set :markdown_engine, :redcarpet
set :markdown, REDCARPET_EXTENTIONS
activate :blog do |blog|
blog.permalink = "blog/:title.html"
blog.sources = "blog/:title.html"
blog.layout = 'article'
end
set :css_dir, 'stylesheets'
set :js_dir, 'javascripts'
set :images_dir, 'images'
# React JSX compiler
require 'react-jsx-sprockets'
# Add marbles-js to sprockets paths
require 'marbles-js'
MarblesJS::Sprockets.setup(sprockets)
require 'fly'
Fly::Sprockets.setup(sprockets)
require 'cupcake-icons'
CupcakeIcons::Sprockets.setup(sprockets)
# Build-specific configuration
configure :build do
activate :minify_css
activate :minify_javascript
activate :asset_hash
activate :gzip
end