forked from greenpeace/ggw_styleguide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.rb
159 lines (118 loc) · 3.76 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# Combine media queries at bottom of document
require 'sass-media_query_combiner'
require 'breakpoint'
require 'singularitygs'
require 'sass-globbing'
require 'uglifier'
# Change Compass configuration
compass_config do |config|
config.output_style = :expanded
end
activate :livereload, :host => "127.0.0.1"
activate :syntax
#with_layout :example do
# page "/examples/*"
#end
#activate :blog do |blog|
# set options on blog
#end
#set :markdown_engine, :redcarpet
###
# Page options, layouts, aliases and proxies
###
page "*/event_map_single.html", :layout => false
page "*/random-private-message.html", :layout => false
page "*/random-private-message*.html", :layout => false
# Per-page layout changes:
#
# With no layout
# page "/path/to/file.html", :layout => false
#
# With alternative layout
# page "/path/to/file.html", :layout => :otherlayout
#
# A path which all have the same layout
# with_layout :admin do
# page "/admin/*"
# end
# Proxy (fake) files
# page "/this-page-has-no-template.html", :proxy => "/template-file.html" do
# @which_fake_page = "Rendering a fake page with a variable"
# end
###
# Helpers
###
# Methods defined in the helpers block are available in templates
# helpers do
# def some_helper
# "Helping"
# end
# end
sprockets.append_path File.join "#{root}", "/source/libraries"
set :css_dir, 'css'
set :js_dir, 'js'
set :images_dir, 'images'
set :fonts_dir, 'fonts'
set :partials_dir, 'partials'
activate :inliner
activate :autoprefixer do |config|
config.browsers = ['last 2 versions', 'Explorer >= 9']
config.cascade = false
config.inline = true
end
helpers do
#
# Check weather the current page is the same as the nav element and set active class
#
def nav_link(name, url, options={})
options = {
class: "",
active_if: url,
page: current_page.url,
}.update options
active_url = options.delete(:active_if)
active = Regexp === active_url ? current_page.url =~ active_url : current_page.url == active_url
options[:class] += " active" if active
link_to name, url, options
end
end
activate :title, site: 'GGW Style Guide', separator: ' — '
# Build-specific configuration
configure :build do
# For example, change the Compass output style for deployment
activate :minify_css
activate :minify_html
activate :imageoptim
# Minify Javascript on build
activate :minify_javascript, :inline => true, compressor: Uglifier.new(:comments => :none, mangle: false)
ignore 'libraries/*'
#activate :gzip
# Uniquely-named assets, preventing users from using outdated files
# Exclude files that are called from template files directly
activate :asset_hash, :ignore => ['.idea','vendor', 'images', 'photos', 'font', 'css/fonticons.woff.css', 'css/fonticons.woff2.css']
# Enable cache buster
# activate :cache_buster
# Use relative URLs
activate :relative_assets
set :relative_links, true
set :url_root, 'http://ggw-prototype.goalgorilla.com'
# disable layout
page ".htaccess.apache", :layout => false
# Compress PNGs after build
# First: gem install middleman-smusher
# require "middleman-smusher"
# activate :smusher
# Or use a different image path
# set :http_path, "/Content/images/"
end
# rename file after build
activate :deploy do |deploy|
deploy.method = :git
deploy.build_before = true # default: false
deploy.branch = "gh-pages"
# Optional Settings
# deploy.remote = 'custom-remote' # remote name or git url, default: origin
# deploy.branch = 'custom-branch' # default: gh-pages
# deploy.strategy = :submodule # commit strategy: can be :force_push or :submodule, default: :force_push
# deploy.commit_message = 'custom-message' # commit message (can be empty), default: Automated commit at `timestamp` by middleman-deploy `version`
end