sass-site/config.rb

64 lines
2.1 KiB
Ruby
Raw Normal View History

2013-10-12 19:43:25 +02:00
require 'middleman-syntax'
2018-12-29 01:38:01 +01:00
require_relative 'lib/rack/try_dynamic'
use Rack::TryDynamic, try: ['.html', '/index.html']
activate :automatic_image_sizes
activate :autoprefixer do |config|
config.browsers = ['last 2 versions']
# config.ignore = ['hacks.css']
end
2018-10-24 00:06:39 +02:00
activate :livereload
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'
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
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
configure :development do
2018-10-22 23:13:05 +02:00
config[:host] = 'http://localhost:4567'
end
configure :build do
2018-10-22 23:13:05 +02:00
config[:host] = data.sitemap.url
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
set :relative_links, true
2013-10-09 12:30:53 +02:00
end
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)
current_page.add_metadata(table_of_contents:
markdown.render(body).sub(/<ul( |>)/, '<ul class="table-of-contents"\1'))
body
end
end