2011-02-11 02:14:33 -05:00
|
|
|
# Middleman is a static site renderer that provides all the conveniences of
|
|
|
|
# a modern web stack, like Ruby on Rails, while remaining focused on building
|
|
|
|
# the fastest, most-professional sites possible
|
|
|
|
#
|
|
|
|
# Install Middleman:
|
|
|
|
#
|
|
|
|
# gem install middleman
|
|
|
|
#
|
|
|
|
# To accomplish its goals, Middleman supports provides access to:
|
|
|
|
#
|
2011-07-27 02:19:43 -04:00
|
|
|
#### Command-line tool:
|
2011-07-27 04:45:57 -04:00
|
|
|
# * **middleman init**: A tool for creating to new static sites.
|
|
|
|
# * **middleman server**: A tool for rapidly developing your static site.
|
|
|
|
# * **middleman build**: A tool for exporting your site into optimized HTML, CSS & JS.
|
2011-02-11 02:14:33 -05:00
|
|
|
#
|
|
|
|
#### Tons of templating languages including:
|
|
|
|
# * ERB (.erb)
|
|
|
|
# * Interpolated String (.str)
|
|
|
|
# * Sass (.sass)
|
|
|
|
# * Scss (.scss)
|
|
|
|
# * Haml (.haml)
|
2011-06-23 21:05:25 -04:00
|
|
|
# * Slim (.slim)
|
2011-02-11 02:14:33 -05:00
|
|
|
# * Less CSS (.less)
|
|
|
|
# * Builder (.builder)
|
|
|
|
# * Liquid (.liquid)
|
|
|
|
# * RDiscount (.markdown)
|
|
|
|
# * RedCloth (.textile)
|
|
|
|
# * RDoc (.rdoc)
|
|
|
|
# * Radius (.radius)
|
|
|
|
# * Markaby (.mab)
|
|
|
|
# * Nokogiri (.nokogiri)
|
|
|
|
# * Mustache (.mustache)
|
|
|
|
# * CoffeeScript (.coffee)
|
|
|
|
#
|
|
|
|
#### Compile-time Optimiztions
|
|
|
|
# * Javascript Minifiers: YUI, Google Closure & UglifyJS
|
|
|
|
# * Smush.it Image Compression
|
|
|
|
# * CSS Minification
|
|
|
|
#
|
|
|
|
#### Robust Extensions:
|
|
|
|
# Add your own runtime and build-time features!
|
|
|
|
#
|
|
|
|
#### Next Steps:
|
|
|
|
# * [Visit the website]
|
|
|
|
# * [Read the wiki]
|
|
|
|
# * [Email the users group]
|
|
|
|
# * [Submit bug reports]
|
|
|
|
#
|
|
|
|
# [Visit the website]: http://middlemanapp.com
|
|
|
|
# [Read the wiki]: https://github.com/tdreyno/middleman/wiki
|
|
|
|
# [Email the users group]: http://groups.google.com/group/middleman-users
|
|
|
|
# [Submit bug reports]: https://github.com/tdreyno/middleman/issues
|
|
|
|
|
2011-07-27 00:05:13 -04:00
|
|
|
# Setup our load paths
|
2009-10-22 20:25:15 -04:00
|
|
|
libdir = File.dirname(__FILE__)
|
|
|
|
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
|
|
|
|
2011-07-13 03:38:04 -04:00
|
|
|
# We're riding on Sinatra, so let's include it.
|
|
|
|
require "sinatra/base"
|
|
|
|
|
2011-02-11 02:14:33 -05:00
|
|
|
# Top-level Middleman object
|
2010-03-03 01:00:46 -05:00
|
|
|
module Middleman
|
2011-02-11 02:14:33 -05:00
|
|
|
# Auto-load modules on-demand
|
2011-07-13 03:38:04 -04:00
|
|
|
autoload :Base, "middleman/base"
|
|
|
|
autoload :Builder, "middleman/builder"
|
2011-07-27 02:19:43 -04:00
|
|
|
autoload :CLI, "middleman/cli"
|
|
|
|
autoload :Templates, "middleman/templates"
|
2011-07-13 21:29:59 -04:00
|
|
|
autoload :Guard, "middleman/guard"
|
2010-09-06 21:48:25 -04:00
|
|
|
|
2011-02-11 02:14:33 -05:00
|
|
|
# Custom Renderers
|
2010-09-06 21:48:25 -04:00
|
|
|
module Renderers
|
2010-09-24 18:56:04 -04:00
|
|
|
autoload :Haml, "middleman/renderers/haml"
|
|
|
|
autoload :Sass, "middleman/renderers/sass"
|
2011-06-02 13:48:56 -04:00
|
|
|
autoload :Slim, "middleman/renderers/slim"
|
2011-06-27 16:10:09 -04:00
|
|
|
autoload :Markdown, "middleman/renderers/markdown"
|
|
|
|
autoload :CoffeeScript, "middleman/renderers/coffee_script"
|
2010-09-06 21:48:25 -04:00
|
|
|
end
|
2011-07-06 12:50:34 -04:00
|
|
|
|
|
|
|
module CoreExtensions
|
2011-07-10 18:10:49 -04:00
|
|
|
# Add Rack::Builder.map support
|
|
|
|
autoload :RackMap, "middleman/core_extensions/rack_map"
|
|
|
|
|
2011-07-06 13:15:31 -04:00
|
|
|
# Custom Feature API
|
|
|
|
autoload :Features, "middleman/core_extensions/features"
|
|
|
|
|
2011-07-06 13:40:17 -04:00
|
|
|
# Asset Path Pipeline
|
|
|
|
autoload :Assets, "middleman/core_extensions/assets"
|
|
|
|
|
2011-07-06 12:50:34 -04:00
|
|
|
# DefaultHelpers are the built-in dynamic template helpers.
|
|
|
|
autoload :DefaultHelpers, "middleman/core_extensions/default_helpers"
|
|
|
|
|
|
|
|
# Data looks at the data/ folder for YAML files and makes them available
|
|
|
|
# to dynamic requests.
|
|
|
|
autoload :Data, "middleman/core_extensions/data"
|
2011-07-06 13:15:31 -04:00
|
|
|
|
|
|
|
# Parse YAML from templates
|
|
|
|
autoload :FrontMatter, "middleman/core_extensions/front_matter"
|
|
|
|
|
|
|
|
# Extended version of Padrino's rendering
|
|
|
|
autoload :Rendering, "middleman/core_extensions/rendering"
|
2011-07-10 18:10:49 -04:00
|
|
|
|
|
|
|
# Compass framework for Sass
|
|
|
|
autoload :Compass, "middleman/core_extensions/compass"
|
|
|
|
|
|
|
|
# Sprockets 2
|
|
|
|
autoload :Sprockets, "middleman/core_extensions/sprockets"
|
2011-07-06 13:46:06 -04:00
|
|
|
|
|
|
|
# Pass custom options to views
|
|
|
|
autoload :Routing, "middleman/core_extensions/routing"
|
2011-07-06 12:50:34 -04:00
|
|
|
end
|
2010-09-06 21:48:25 -04:00
|
|
|
|
2011-07-06 13:15:31 -04:00
|
|
|
module Features
|
|
|
|
# RelativeAssets allow any asset path in dynamic templates to be either
|
|
|
|
# relative to the root of the project or use an absolute URL.
|
|
|
|
autoload :RelativeAssets, "middleman/features/relative_assets"
|
|
|
|
|
2011-07-10 16:55:40 -04:00
|
|
|
# AssetHost allows you to setup multiple domains to host your static
|
|
|
|
# assets. Calls to asset paths in dynamic templates will then rotate
|
|
|
|
# through each of the asset servers to better spread the load.
|
2011-07-06 13:15:31 -04:00
|
|
|
autoload :AssetHost, "middleman/features/asset_host"
|
|
|
|
|
|
|
|
# CacheBuster adds a query string to assets in dynamic templates to avoid
|
|
|
|
# browser caches failing to update to your new content.
|
|
|
|
autoload :CacheBuster, "middleman/features/cache_buster"
|
|
|
|
|
2011-07-10 16:55:40 -04:00
|
|
|
# AutomaticImageSizes inspects the images used in your dynamic templates
|
|
|
|
# and automatically adds width and height attributes to their HTML
|
|
|
|
# elements.
|
2011-07-06 13:15:31 -04:00
|
|
|
autoload :AutomaticImageSizes, "middleman/features/automatic_image_sizes"
|
|
|
|
|
|
|
|
# MinifyCss uses the YUI compressor to shrink CSS files
|
|
|
|
autoload :MinifyCss, "middleman/features/minify_css"
|
|
|
|
|
|
|
|
# MinifyJavascript uses the YUI compressor to shrink JS files
|
|
|
|
autoload :MinifyJavascript, "middleman/features/minify_javascript"
|
|
|
|
|
2011-07-10 16:55:40 -04:00
|
|
|
# Lorem provides a handful of helpful prototyping methods to generate
|
|
|
|
# words, paragraphs, fake images, names and email addresses.
|
2011-07-06 13:15:31 -04:00
|
|
|
autoload :Lorem, "middleman/features/lorem"
|
|
|
|
|
|
|
|
# Treat project as a blog
|
|
|
|
autoload :Blog, "middleman/features/blog"
|
2011-07-13 21:45:15 -04:00
|
|
|
|
|
|
|
# guard-livereload
|
|
|
|
autoload :LiveReload, "middleman/features/live_reload"
|
2011-07-06 13:15:31 -04:00
|
|
|
|
|
|
|
# Automatically resize images for mobile devises
|
|
|
|
# autoload :TinySrc, "middleman/features/tiny_src"
|
2011-07-27 22:59:38 -04:00
|
|
|
|
|
|
|
# Automatically convert filename.html files into filename/index.html
|
|
|
|
autoload :DirectoryIndexes, "middleman/features/directory_indexes"
|
2011-07-13 03:38:04 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.server(&block)
|
|
|
|
sandbox = Class.new(Sinatra::Base)
|
|
|
|
sandbox.register Base
|
|
|
|
sandbox.class_eval(&block) if block_given?
|
|
|
|
sandbox
|
2011-07-06 13:15:31 -04:00
|
|
|
end
|
2010-08-06 12:59:38 -04:00
|
|
|
end
|