### # Page options, layouts, aliases and proxies ###
# 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 pages (middlemanapp.com/dynamic-pages/) # proxy “/this-page-has-no-template.html”, “/template-file.html”, :locals => { # :which_fake_page => “Rendering a fake page with a local variable” }
# variables @image_dir = ‘img’ @css_dir = ‘css’ @js_dir = ‘js’
### # Helpers ###
# Automatic image dimensions on image_tag helper # activate :automatic_image_sizes
# Reload the browser automatically whenever files change activate :livereload
set :relative_links, true
# remove file extensions from url activate :directory_indexes
# Methods defined in the helpers block are available in templates helpers do
def is_page page_classes if page_classes != 'index' return 'page' end end def img return "../#{@image_dir}" end
end
# Enable Slim support require ‘slim’
<% if options -%> set :css_dir, ‘<%= options -%>’ <% else -%> # Change the CSS directory # set :css_dir, “alternative_css_directory” <% end -%>
<% if options -%> set :js_dir, ‘<%= options -%>’ <% else -%> # Change the JS directory # set :js_dir, “alternative_js_directory” <% end -%>
<% if options -%> set :images_dir, ‘<%= options -%>’ <% else -%> # Change the images directory # set :images_dir, “alternative_image_directory” <% end -%>
# Add Bower’s directory to Sprockets asset path. This expects Bower to be installed in the root of the Middleman
project # Example: bower install jquery sprockets.append_path ‘../bower_components/’
# Compress images activate :imageoptim do |image_optim|
image_optim.pngout_options = false # Should disable pngout
end
# activate :deploy do |deploy| # deploy.method = :rsync # deploy.host = “” # deploy.path = “/var/www/vhosts/…” # # Optional Settings # # deploy.user = “tvaughan” # no default # # deploy.port = 5309 # ssh port, default: 22 # # deploy.clean = true # remove orphaned files on remote host, default: false # deploy.flags = “-rltgoDvzO –no-p –del” # add custom flags, default: -avz # deploy.build_before = true # default: false # end
# Build-specific configuration configure :build do
# For example, change the Compass output style for deployment activate :minify_html activate :minify_css # Minify Javascript on build activate :minify_javascript activate :gzip # Enable cache buster # activate :asset_hash # Use relative URLs activate :relative_assets # Or use a different image path # set :http_path, "/Content/images/"
end