2012-10-30 05:19:53 +01:00
|
|
|
# ----------------------------------------------
|
|
|
|
# Page Processing
|
|
|
|
# ----------------------------------------------
|
2012-09-27 12:26:50 +02:00
|
|
|
set :markdown_engine, :redcarpet
|
2012-10-30 05:19:53 +01:00
|
|
|
set :markdown, :fenced_code_blocks => true,
|
|
|
|
:autolink => true,
|
|
|
|
:smartypants => true
|
|
|
|
# ----------------------------------------------
|
|
|
|
# Livreload
|
|
|
|
# ----------------------------------------------
|
2012-09-27 12:26:50 +02:00
|
|
|
activate :livereload
|
|
|
|
|
2012-10-30 05:19:53 +01:00
|
|
|
# ----------------------------------------------
|
|
|
|
# CSS Processing
|
|
|
|
# ----------------------------------------------
|
2012-09-10 01:37:46 +02:00
|
|
|
|
|
|
|
# Susy grids in Compass
|
|
|
|
# First: gem install susy --pre
|
2012-10-30 05:19:53 +01:00
|
|
|
require 'susy'
|
2012-09-10 01:37:46 +02:00
|
|
|
|
|
|
|
# Change Compass configuration
|
|
|
|
compass_config do |config|
|
2012-10-30 05:19:53 +01:00
|
|
|
config.output_style = :expanded
|
|
|
|
# config.sass_options = { :line_comments => true, :debug_info => true }
|
2012-09-10 01:37:46 +02:00
|
|
|
end
|
|
|
|
|
2012-10-30 05:19:53 +01:00
|
|
|
# ----------------------------------------------
|
2012-09-10 01:37:46 +02:00
|
|
|
# Page options, layouts, aliases and proxies
|
2012-10-30 05:19:53 +01:00
|
|
|
# ----------------------------------------------
|
2012-09-10 01:37:46 +02:00
|
|
|
|
|
|
|
# Per-page layout changes:
|
|
|
|
#
|
|
|
|
# With no layout
|
2012-09-27 12:26:50 +02:00
|
|
|
page "/responsive.html", :layout => false
|
2012-09-10 01:37:46 +02:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2012-10-30 05:19:53 +01:00
|
|
|
# ----------------------------------------------
|
|
|
|
# Styleguide
|
|
|
|
# ----------------------------------------------
|
|
|
|
|
|
|
|
# Use KSS for awesome styleguide support
|
|
|
|
# require "kss"
|
|
|
|
#
|
|
|
|
# page "/styleguide/*", :layout => "styleguide" do
|
|
|
|
# @styleguide = Kss::Parser.new('source/css')
|
|
|
|
# end
|
|
|
|
|
|
|
|
# ----------------------------------------------
|
2012-09-10 01:37:46 +02:00
|
|
|
# Helpers
|
2012-10-30 05:19:53 +01:00
|
|
|
# ----------------------------------------------
|
2012-09-10 01:37:46 +02:00
|
|
|
|
|
|
|
# Automatic image dimensions on image_tag helper
|
|
|
|
# activate :automatic_image_sizes
|
|
|
|
|
2012-09-27 12:26:50 +02:00
|
|
|
activate :directory_indexes
|
|
|
|
|
2012-09-10 01:37:46 +02:00
|
|
|
# Methods defined in the helpers block are available in templates
|
|
|
|
# helpers do
|
|
|
|
# def some_helper
|
|
|
|
# "Helping"
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
|
2012-10-30 05:19:53 +01:00
|
|
|
helpers do
|
|
|
|
# Generates a styleguide block.
|
|
|
|
# def styleguide_block(section, &block)
|
|
|
|
# @section = @styleguide.section(section)
|
|
|
|
# @example_html = kss_capture{ block.call }
|
|
|
|
# @_out_buf << partial('styleguide/block')
|
|
|
|
# end
|
|
|
|
#
|
|
|
|
# # Captures the result of a block within an erb template without # spitting it
|
|
|
|
# # to the output buffer.
|
|
|
|
# def kss_capture(&block)
|
|
|
|
# out, @_out_buf = @_out_buf, ""
|
|
|
|
# yield
|
|
|
|
# @_out_buf
|
|
|
|
# ensure
|
|
|
|
# @_out_buf = out
|
|
|
|
# end
|
|
|
|
|
|
|
|
# Calculate the years for a copyright
|
|
|
|
def copyright_years(start_year)
|
|
|
|
end_year = Date.today.year
|
|
|
|
if start_year == end_year
|
|
|
|
start_year.to_s
|
|
|
|
else
|
|
|
|
start_year.to_s + '-' + end_year.to_s
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# ----------------------------------------------
|
|
|
|
# Directories
|
|
|
|
# ----------------------------------------------
|
2012-09-10 01:37:46 +02:00
|
|
|
|
2012-10-30 05:19:53 +01:00
|
|
|
set :css_dir, 'assets/stylesheets'
|
2012-09-10 01:37:46 +02:00
|
|
|
|
2012-10-30 05:19:53 +01:00
|
|
|
set :js_dir, 'assets/javascripts'
|
2012-09-10 01:37:46 +02:00
|
|
|
|
2012-10-30 05:19:53 +01:00
|
|
|
set :images_dir, 'assets/images'
|
|
|
|
|
|
|
|
# ----------------------------------------------
|
2012-09-10 01:37:46 +02:00
|
|
|
# Build-specific configuration
|
2012-10-30 05:19:53 +01:00
|
|
|
# ----------------------------------------------
|
|
|
|
|
2012-09-10 01:37:46 +02:00
|
|
|
configure :build do
|
|
|
|
# For example, change the Compass output style for deployment
|
2012-09-27 12:26:50 +02:00
|
|
|
activate :minify_css
|
2012-09-10 01:37:46 +02:00
|
|
|
|
|
|
|
# Minify Javascript on build
|
2012-09-27 12:26:50 +02:00
|
|
|
activate :minify_javascript
|
|
|
|
|
|
|
|
# Create favicon/touch icon set from source/favicon_base.png
|
|
|
|
activate :favicon_maker
|
2012-09-10 01:37:46 +02:00
|
|
|
|
|
|
|
# Enable cache buster
|
|
|
|
# activate :cache_buster
|
|
|
|
|
|
|
|
# Use relative URLs
|
|
|
|
# activate :relative_assets
|
|
|
|
|
|
|
|
# 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
|