-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.rb
67 lines (54 loc) · 1.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
require 'ostruct'
require 'sprockets/es6'
configure :development do
activate :livereload
end
helpers do
def yaml_data(yaml_name)
struct_array YAML.load(File.read(File.join(root, "source/data/#{yaml_name}.yml")))
end
def work_data(yaml_name)
data = yaml_data(yaml_name)
data.map do |category|
category.projects = struct_array(category.projects)
category
end
end
def struct_array(array)
array.map { |a| OpenStruct.new(a) }
end
def nice_link_to_url(url)
return if url.nil?
nice_url = url.gsub(%r{https?://}, '').gsub(%r{/$}, '')
link_to nice_url, url, target: '_blank'
end
def markdown(text)
render_options = {
hard_wrap: true,
link_attributes: { target: '_blank' }
}
extensions = { autolink: true }
renderer = Redcarpet::Render::HTML.new(render_options)
Redcarpet::Markdown.new(renderer, extensions).render(text).html_safe
end
def header(title)
partial 'header', locals: { title: title }
end
end
activate :sprockets do |s|
s.supported_output_extensions << '.es6'
end
activate :autoprefixer
sprockets.append_path File.join(root, 'bower_components')
set :css_dir, 'stylesheets'
set :js_dir, 'javascripts'
set :images_dir, 'images'
set :markdown_engine, :redcarpet
configure :build do
# For example, change the Compass output style for deployment
activate :minify_css
# Minify Javascript on build
activate :minify_javascript
# Enable cache buster
activate :asset_hash
end