make some deps dynamically loaded
This commit is contained in:
parent
22f3f0bc8c
commit
f99b9fb2ca
7 changed files with 97 additions and 104 deletions
|
@ -101,34 +101,28 @@ module Middleman
|
||||||
# relative to the root of the project or use an absolute URL.
|
# relative to the root of the project or use an absolute URL.
|
||||||
autoload :RelativeAssets, "middleman/features/relative_assets"
|
autoload :RelativeAssets, "middleman/features/relative_assets"
|
||||||
|
|
||||||
# AssetHost allows you to setup multiple domains to host your static assets.
|
# AssetHost allows you to setup multiple domains to host your static
|
||||||
# Calls to asset paths in dynamic templates will then rotate through each of
|
# assets. Calls to asset paths in dynamic templates will then rotate
|
||||||
# the asset servers to better spread the load.
|
# through each of the asset servers to better spread the load.
|
||||||
autoload :AssetHost, "middleman/features/asset_host"
|
autoload :AssetHost, "middleman/features/asset_host"
|
||||||
|
|
||||||
# CacheBuster adds a query string to assets in dynamic templates to avoid
|
# CacheBuster adds a query string to assets in dynamic templates to avoid
|
||||||
# browser caches failing to update to your new content.
|
# browser caches failing to update to your new content.
|
||||||
autoload :CacheBuster, "middleman/features/cache_buster"
|
autoload :CacheBuster, "middleman/features/cache_buster"
|
||||||
|
|
||||||
# AutomaticImageSizes inspects the images used in your dynamic templates and
|
# AutomaticImageSizes inspects the images used in your dynamic templates
|
||||||
# automatically adds width and height attributes to their HTML elements.
|
# and automatically adds width and height attributes to their HTML
|
||||||
|
# elements.
|
||||||
autoload :AutomaticImageSizes, "middleman/features/automatic_image_sizes"
|
autoload :AutomaticImageSizes, "middleman/features/automatic_image_sizes"
|
||||||
|
|
||||||
# UglyHaml enables the non-indented output format from Haml templates. Useful
|
|
||||||
# for somewhat obfuscating the output and hiding the fact that you're using Haml.
|
|
||||||
autoload :UglyHaml, "middleman/features/ugly_haml"
|
|
||||||
|
|
||||||
# MinifyCss uses the YUI compressor to shrink CSS files
|
# MinifyCss uses the YUI compressor to shrink CSS files
|
||||||
autoload :MinifyCss, "middleman/features/minify_css"
|
autoload :MinifyCss, "middleman/features/minify_css"
|
||||||
|
|
||||||
# MinifyJavascript uses the YUI compressor to shrink JS files
|
# MinifyJavascript uses the YUI compressor to shrink JS files
|
||||||
autoload :MinifyJavascript, "middleman/features/minify_javascript"
|
autoload :MinifyJavascript, "middleman/features/minify_javascript"
|
||||||
|
|
||||||
# CodeRay is a syntax highlighter.
|
# Lorem provides a handful of helpful prototyping methods to generate
|
||||||
autoload :CodeRay, "middleman/features/code_ray"
|
# words, paragraphs, fake images, names and email addresses.
|
||||||
|
|
||||||
# Lorem provides a handful of helpful prototyping methods to generate words,
|
|
||||||
# paragraphs, fake images, names and email addresses.
|
|
||||||
autoload :Lorem, "middleman/features/lorem"
|
autoload :Lorem, "middleman/features/lorem"
|
||||||
|
|
||||||
# Treat project as a blog
|
# Treat project as a blog
|
||||||
|
@ -143,8 +137,8 @@ module Middleman
|
||||||
# Automatically resize images for mobile devises
|
# Automatically resize images for mobile devises
|
||||||
# autoload :TinySrc, "middleman/features/tiny_src"
|
# autoload :TinySrc, "middleman/features/tiny_src"
|
||||||
|
|
||||||
# LiveReload will auto-reload browsers with the live reload extension installed after changes
|
# LiveReload will auto-reload browsers with the live reload extension
|
||||||
# Currently disabled and untested.
|
# installed after changes. Currently disabled and untested.
|
||||||
# autoload :LiveReload, "middleman/features/live_reload"
|
# autoload :LiveReload, "middleman/features/live_reload"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
module Middleman::Features::CodeRay
|
|
||||||
class << self
|
|
||||||
def registered(app)
|
|
||||||
begin
|
|
||||||
require 'haml-coderay'
|
|
||||||
rescue LoadError
|
|
||||||
puts "CodeRay not available. Install it with: gem install haml-coderay"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
alias :included :registered
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,8 +0,0 @@
|
||||||
module Middleman::Features::UglyHaml
|
|
||||||
class << self
|
|
||||||
def registered(app)
|
|
||||||
app.set :haml, app.settings.haml.merge({ :ugly_haml => true })
|
|
||||||
end
|
|
||||||
alias :included :registered
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -5,9 +5,20 @@ module Middleman::Renderers::Haml
|
||||||
require "haml"
|
require "haml"
|
||||||
|
|
||||||
# Coffee-script filter for Haml
|
# Coffee-script filter for Haml
|
||||||
require "coffee-filter"
|
begin
|
||||||
|
require "coffee-filter"
|
||||||
|
rescue LoadError
|
||||||
|
end
|
||||||
|
|
||||||
|
# Code-ray Syntax highlighting
|
||||||
|
begin
|
||||||
|
require 'haml-coderay'
|
||||||
|
rescue LoadError
|
||||||
|
end
|
||||||
|
|
||||||
app.helpers Helpers
|
app.helpers Helpers
|
||||||
|
|
||||||
|
#app.set :haml, app.settings.haml.merge({ :ugly_haml => true })
|
||||||
end
|
end
|
||||||
alias :included :registered
|
alias :included :registered
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,76 +1,77 @@
|
||||||
require "sass"
|
require "sass"
|
||||||
require "sass/plugin"
|
require "sass/plugin"
|
||||||
require "compass"
|
require "compass"
|
||||||
require "susy"
|
|
||||||
|
|
||||||
module Middleman
|
module Middleman::Renderers::Sass
|
||||||
module Renderers
|
class << self
|
||||||
module Sass
|
def registered(app)
|
||||||
class << self
|
# Susy grids
|
||||||
def registered(app)
|
begin
|
||||||
app.after_feature_init do
|
require "susy"
|
||||||
views_root = File.basename(app.views)
|
rescue LoadError
|
||||||
::Compass.configuration do |config|
|
|
||||||
config.cache = false # For sassc files
|
|
||||||
config.project_path = app.root
|
|
||||||
config.sass_dir = File.join(views_root, app.css_dir)
|
|
||||||
config.output_style = :nested
|
|
||||||
config.fonts_dir = File.join(views_root, app.fonts_dir)
|
|
||||||
config.css_dir = File.join(views_root, app.css_dir)
|
|
||||||
config.images_dir = File.join(views_root, app.images_dir)
|
|
||||||
config.http_images_path = app.http_images_path rescue File.join(app.http_prefix || "/", app.images_dir)
|
|
||||||
config.http_stylesheets_path = app.http_css_path rescue File.join(app.http_prefix || "/", app.css_dir)
|
|
||||||
config.asset_cache_buster :none
|
|
||||||
|
|
||||||
config.add_import_path(config.sass_dir)
|
|
||||||
end
|
|
||||||
|
|
||||||
# configure :build do
|
|
||||||
# build_root = File.basename(self.build_dir)
|
|
||||||
# ::Compass.configuration do |config|
|
|
||||||
# config.css_dir = File.join(build_root, self.css_dir)
|
|
||||||
# config.images_dir = File.join(build_root, self.images_dir)
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
alias :included :registered
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class SassPlusCSSFilenameTemplate < ::Tilt::SassTemplate
|
app.after_feature_init do
|
||||||
def sass_options
|
views_root = File.basename(app.views)
|
||||||
return super if basename.nil?
|
::Compass.configuration do |config|
|
||||||
|
config.cache = false # For sassc files
|
||||||
|
config.project_path = app.root
|
||||||
|
config.sass_dir = File.join(views_root, app.css_dir)
|
||||||
|
config.output_style = :nested
|
||||||
|
config.fonts_dir = File.join(views_root, app.fonts_dir)
|
||||||
|
config.css_dir = File.join(views_root, app.css_dir)
|
||||||
|
config.images_dir = File.join(views_root, app.images_dir)
|
||||||
|
config.http_images_path = app.http_images_path rescue File.join(app.http_prefix || "/", app.images_dir)
|
||||||
|
config.http_stylesheets_path = app.http_css_path rescue File.join(app.http_prefix || "/", app.css_dir)
|
||||||
|
config.asset_cache_buster :none
|
||||||
|
|
||||||
location_of_sass_file = Middleman::Server.environment == :build ?
|
config.add_import_path(config.sass_dir)
|
||||||
File.join(Middleman::Server.root, Middleman::Server.build_dir) :
|
|
||||||
Middleman::Server.views
|
|
||||||
|
|
||||||
parts = basename.split('.')
|
|
||||||
parts.pop
|
|
||||||
css_filename = File.join(location_of_sass_file, Middleman::Server.css_dir, parts.join("."))
|
|
||||||
super.merge(::Compass.configuration.to_sass_engine_options).merge(:css_filename => css_filename)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def evaluate(scope, locals, &block)
|
# configure :build do
|
||||||
begin
|
# build_root = File.basename(self.build_dir)
|
||||||
super
|
# ::Compass.configuration do |config|
|
||||||
rescue Sass::SyntaxError => e
|
# config.css_dir = File.join(build_root, self.css_dir)
|
||||||
Sass::SyntaxError.exception_to_css(e, :full_exception => true)
|
# config.images_dir = File.join(build_root, self.images_dir)
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
::Tilt.register 'sass', SassPlusCSSFilenameTemplate
|
end
|
||||||
::Tilt.prefer(SassPlusCSSFilenameTemplate)
|
alias :included :registered
|
||||||
|
end
|
||||||
|
|
||||||
class ScssPlusCSSFilenameTemplate < SassPlusCSSFilenameTemplate
|
class SassPlusCSSFilenameTemplate < ::Tilt::SassTemplate
|
||||||
def sass_options
|
def sass_options
|
||||||
super.merge(:syntax => :scss)
|
return super if basename.nil?
|
||||||
end
|
|
||||||
|
location_of_sass_file = Middleman::Server.environment == :build ?
|
||||||
|
File.join(Middleman::Server.root, Middleman::Server.build_dir) :
|
||||||
|
Middleman::Server.views
|
||||||
|
|
||||||
|
parts = basename.split('.')
|
||||||
|
parts.pop
|
||||||
|
css_filename = File.join(location_of_sass_file, Middleman::Server.css_dir, parts.join("."))
|
||||||
|
super.merge(::Compass.configuration.to_sass_engine_options).merge(:css_filename => css_filename)
|
||||||
|
end
|
||||||
|
|
||||||
|
def evaluate(scope, locals, &block)
|
||||||
|
begin
|
||||||
|
super
|
||||||
|
rescue Sass::SyntaxError => e
|
||||||
|
Sass::SyntaxError.exception_to_css(e, :full_exception => true)
|
||||||
end
|
end
|
||||||
::Tilt.register 'scss', ScssPlusCSSFilenameTemplate
|
|
||||||
::Tilt.prefer(ScssPlusCSSFilenameTemplate)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
::Tilt.register 'sass', SassPlusCSSFilenameTemplate
|
||||||
|
::Tilt.prefer(SassPlusCSSFilenameTemplate)
|
||||||
|
|
||||||
|
class ScssPlusCSSFilenameTemplate < SassPlusCSSFilenameTemplate
|
||||||
|
def sass_options
|
||||||
|
super.merge(:syntax => :scss)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
::Tilt.register 'scss', ScssPlusCSSFilenameTemplate
|
||||||
|
::Tilt.prefer(ScssPlusCSSFilenameTemplate)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Use compass settings in Haml filters
|
# Use compass settings in Haml filters
|
||||||
|
|
|
@ -1,7 +1,17 @@
|
||||||
# CodeRay syntax highlighting in Haml
|
# Susy grids in Compass
|
||||||
# activate :code_ray
|
# First: gem install compass-susy-plugin
|
||||||
|
# require 'susy'
|
||||||
|
|
||||||
# Automatic sitemaps (gem install middleman-slickmap)
|
# CodeRay syntax highlighting in Haml
|
||||||
|
# First: gem install haml-coderay
|
||||||
|
# require 'haml-coderay'
|
||||||
|
|
||||||
|
# CoffeeScript filters in Haml
|
||||||
|
# First: gem install coffee-filter
|
||||||
|
# require 'coffee-filter'
|
||||||
|
|
||||||
|
# Automatic sitemaps
|
||||||
|
# First: gem install middleman-slickmap
|
||||||
# require "middleman-slickmap"
|
# require "middleman-slickmap"
|
||||||
# activate :slickmap
|
# activate :slickmap
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ Gem::Specification.new do |s|
|
||||||
s.platform = Gem::Platform::RUBY
|
s.platform = Gem::Platform::RUBY
|
||||||
s.authors = ["Thomas Reynolds"]
|
s.authors = ["Thomas Reynolds"]
|
||||||
s.email = ["tdreyno@gmail.com"]
|
s.email = ["tdreyno@gmail.com"]
|
||||||
s.homepage = "http://wiki.github.com/tdreyno/middleman"
|
s.homepage = "http://middlemanapp.com"
|
||||||
s.summary = "A static site generator based on Sinatra. Providing Haml, Sass, Compass, Less, Coffee Script and including minification, compression and cache busting."
|
s.summary = "A static site generator based on Sinatra. Providing Haml, Sass, Compass, CoffeeScript and including minification, compression and cache busting."
|
||||||
|
|
||||||
s.rubyforge_project = "middleman"
|
s.rubyforge_project = "middleman"
|
||||||
|
|
||||||
|
@ -29,11 +29,8 @@ Gem::Specification.new do |s|
|
||||||
s.add_runtime_dependency("uglifier", ["~> 0.5.0"])
|
s.add_runtime_dependency("uglifier", ["~> 0.5.0"])
|
||||||
s.add_runtime_dependency("slim", ["~> 0.9.4"])
|
s.add_runtime_dependency("slim", ["~> 0.9.4"])
|
||||||
s.add_runtime_dependency("haml", ["~> 3.1.0"])
|
s.add_runtime_dependency("haml", ["~> 3.1.0"])
|
||||||
s.add_runtime_dependency("coffee-filter", ["~> 0.1.0"])
|
|
||||||
s.add_runtime_dependency("sass", ["~> 3.1.0"])
|
s.add_runtime_dependency("sass", ["~> 3.1.0"])
|
||||||
s.add_runtime_dependency("compass", ["~> 0.11.3"])
|
s.add_runtime_dependency("compass", ["~> 0.11.3"])
|
||||||
s.add_runtime_dependency("compass-susy-plugin", ["~> 0.9.0"])
|
|
||||||
s.add_runtime_dependency("coffee-script", ["~> 2.2.0"])
|
|
||||||
s.add_runtime_dependency("httparty", ["~> 0.7.0"])
|
s.add_runtime_dependency("httparty", ["~> 0.7.0"])
|
||||||
s.add_development_dependency("spork", ["~> 0.9.0.rc8"])
|
s.add_development_dependency("spork", ["~> 0.9.0.rc8"])
|
||||||
s.add_development_dependency("cucumber", ["~> 0.10.0"])
|
s.add_development_dependency("cucumber", ["~> 0.10.0"])
|
||||||
|
|
Loading…
Reference in a new issue