2013-10-12 19:43:25 +02:00
|
|
|
require 'middleman-syntax'
|
2013-10-12 23:14:31 +02:00
|
|
|
|
2015-10-14 01:55:29 +02:00
|
|
|
activate :automatic_image_sizes
|
|
|
|
activate :autoprefixer do |config|
|
2018-10-27 06:35:30 +02:00
|
|
|
config.browsers = ['last 2 versions']
|
2015-10-14 01:55:29 +02:00
|
|
|
# config.ignore = ['hacks.css']
|
|
|
|
end
|
2012-09-27 12:26:50 +02:00
|
|
|
activate :directory_indexes
|
2018-10-24 00:06:39 +02:00
|
|
|
activate :livereload
|
2014-07-31 07:26:38 +02:00
|
|
|
activate :syntax
|
2012-09-27 12:26:50 +02:00
|
|
|
|
2013-10-09 12:30:53 +02:00
|
|
|
set :markdown, :fenced_code_blocks => true,
|
|
|
|
:autolink => true,
|
2018-08-11 01:39:18 +02:00
|
|
|
:smartypants => true,
|
|
|
|
:with_toc_data => true
|
2013-10-09 12:30:53 +02:00
|
|
|
set :markdown_engine, :redcarpet
|
2013-10-14 21:52:40 +02:00
|
|
|
set :css_dir, 'assets/css'
|
|
|
|
set :js_dir, 'assets/js'
|
|
|
|
set :images_dir, 'assets/img'
|
2012-10-30 05:19:53 +01:00
|
|
|
|
2018-10-27 06:35:30 +02:00
|
|
|
page '/*.xml', :layout => false
|
|
|
|
page '/*.json', :layout => false
|
|
|
|
page '/*.txt', :layout => false
|
|
|
|
page '/*.html', :layout => :has_navigation
|
|
|
|
page '/community.html', :layout => :has_complementary
|
|
|
|
page '/community-guidelines.html', :layout => :has_complementary
|
|
|
|
page '/libsass.html', :layout => :has_both_sidebars
|
|
|
|
page '/404.html', :layout => :has_no_sidebars
|
2018-12-28 01:31:28 +01:00
|
|
|
page '/about.html', :layout => :has_no_sidebars
|
|
|
|
page '/implementation.html', :layout => :has_no_sidebars
|
2018-10-27 06:35:30 +02:00
|
|
|
page '/install.html', :layout => :has_no_sidebars
|
|
|
|
page '/dart-sass.html', :layout => :has_no_sidebars
|
|
|
|
page '/ruby-sass.html', :layout => :has_no_sidebars
|
|
|
|
page '/styleguide/*', :layout => :section_styleguide
|
|
|
|
page '/documentation/*', :layout => :section_reference
|
2018-08-11 01:39:18 +02:00
|
|
|
|
2014-07-31 07:26:38 +02:00
|
|
|
configure :development do
|
2018-10-22 23:13:05 +02:00
|
|
|
config[:host] = 'http://localhost:4567'
|
2014-07-31 07:26:38 +02:00
|
|
|
end
|
|
|
|
|
2012-09-10 01:37:46 +02:00
|
|
|
configure :build do
|
2018-10-22 23:13:05 +02:00
|
|
|
config[:host] = data.sitemap.url
|
2014-07-31 07:26:38 +02:00
|
|
|
activate :asset_hash
|
|
|
|
activate :gzip
|
2012-09-27 12:26:50 +02:00
|
|
|
activate :minify_css
|
2014-07-31 07:34:47 +02:00
|
|
|
activate :minify_html
|
2012-09-27 12:26:50 +02:00
|
|
|
activate :minify_javascript
|
2014-07-31 07:26:38 +02:00
|
|
|
activate :relative_assets
|
|
|
|
|
|
|
|
set :relative_links, true
|
2013-10-09 12:30:53 +02:00
|
|
|
end
|
2018-11-30 00:43:18 +01:00
|
|
|
|
|
|
|
before_render do |body, _, _, template_class|
|
|
|
|
if current_page.data.table_of_contents &&
|
|
|
|
template_class == Middleman::Renderers::RedcarpetTemplate
|
|
|
|
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML_TOC.new)
|
2018-12-28 23:49:59 +01:00
|
|
|
current_page.add_metadata(table_of_contents:
|
|
|
|
markdown.render(body).sub(/<ul( |>)/, '<ul class="table-of-contents"\1'))
|
|
|
|
body
|
2018-11-30 00:43:18 +01:00
|
|
|
end
|
|
|
|
end
|