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.
|
||||
autoload :RelativeAssets, "middleman/features/relative_assets"
|
||||
|
||||
# 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.
|
||||
# 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.
|
||||
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"
|
||||
|
||||
# AutomaticImageSizes inspects the images used in your dynamic templates and
|
||||
# automatically adds width and height attributes to their HTML elements.
|
||||
# AutomaticImageSizes inspects the images used in your dynamic templates
|
||||
# and automatically adds width and height attributes to their HTML
|
||||
# elements.
|
||||
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
|
||||
autoload :MinifyCss, "middleman/features/minify_css"
|
||||
|
||||
# MinifyJavascript uses the YUI compressor to shrink JS files
|
||||
autoload :MinifyJavascript, "middleman/features/minify_javascript"
|
||||
|
||||
# CodeRay is a syntax highlighter.
|
||||
autoload :CodeRay, "middleman/features/code_ray"
|
||||
|
||||
# Lorem provides a handful of helpful prototyping methods to generate 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"
|
||||
|
||||
# Treat project as a blog
|
||||
|
@ -143,8 +137,8 @@ module Middleman
|
|||
# Automatically resize images for mobile devises
|
||||
# autoload :TinySrc, "middleman/features/tiny_src"
|
||||
|
||||
# LiveReload will auto-reload browsers with the live reload extension installed after changes
|
||||
# Currently disabled and untested.
|
||||
# LiveReload will auto-reload browsers with the live reload extension
|
||||
# installed after changes. Currently disabled and untested.
|
||||
# autoload :LiveReload, "middleman/features/live_reload"
|
||||
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"
|
||||
|
||||
# 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.set :haml, app.settings.haml.merge({ :ugly_haml => true })
|
||||
end
|
||||
alias :included :registered
|
||||
end
|
||||
|
|
|
@ -1,76 +1,77 @@
|
|||
require "sass"
|
||||
require "sass/plugin"
|
||||
require "compass"
|
||||
require "susy"
|
||||
|
||||
module Middleman
|
||||
module Renderers
|
||||
module Sass
|
||||
class << self
|
||||
def registered(app)
|
||||
app.after_feature_init do
|
||||
views_root = File.basename(app.views)
|
||||
::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
|
||||
module Middleman::Renderers::Sass
|
||||
class << self
|
||||
def registered(app)
|
||||
# Susy grids
|
||||
begin
|
||||
require "susy"
|
||||
rescue LoadError
|
||||
end
|
||||
|
||||
class SassPlusCSSFilenameTemplate < ::Tilt::SassTemplate
|
||||
def sass_options
|
||||
return super if basename.nil?
|
||||
app.after_feature_init do
|
||||
views_root = File.basename(app.views)
|
||||
::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 ?
|
||||
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)
|
||||
config.add_import_path(config.sass_dir)
|
||||
end
|
||||
|
||||
def evaluate(scope, locals, &block)
|
||||
begin
|
||||
super
|
||||
rescue Sass::SyntaxError => e
|
||||
Sass::SyntaxError.exception_to_css(e, :full_exception => true)
|
||||
end
|
||||
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
|
||||
::Tilt.register 'sass', SassPlusCSSFilenameTemplate
|
||||
::Tilt.prefer(SassPlusCSSFilenameTemplate)
|
||||
end
|
||||
alias :included :registered
|
||||
end
|
||||
|
||||
class SassPlusCSSFilenameTemplate < ::Tilt::SassTemplate
|
||||
def sass_options
|
||||
return super if basename.nil?
|
||||
|
||||
class ScssPlusCSSFilenameTemplate < SassPlusCSSFilenameTemplate
|
||||
def sass_options
|
||||
super.merge(:syntax => :scss)
|
||||
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
|
||||
::Tilt.register 'scss', ScssPlusCSSFilenameTemplate
|
||||
::Tilt.prefer(ScssPlusCSSFilenameTemplate)
|
||||
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
|
||||
|
||||
# Use compass settings in Haml filters
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
# CodeRay syntax highlighting in Haml
|
||||
# activate :code_ray
|
||||
# Susy grids in Compass
|
||||
# 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"
|
||||
# activate :slickmap
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ Gem::Specification.new do |s|
|
|||
s.platform = Gem::Platform::RUBY
|
||||
s.authors = ["Thomas Reynolds"]
|
||||
s.email = ["tdreyno@gmail.com"]
|
||||
s.homepage = "http://wiki.github.com/tdreyno/middleman"
|
||||
s.summary = "A static site generator based on Sinatra. Providing Haml, Sass, Compass, Less, Coffee Script and including minification, compression and cache busting."
|
||||
s.homepage = "http://middlemanapp.com"
|
||||
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"
|
||||
|
||||
|
@ -29,11 +29,8 @@ Gem::Specification.new do |s|
|
|||
s.add_runtime_dependency("uglifier", ["~> 0.5.0"])
|
||||
s.add_runtime_dependency("slim", ["~> 0.9.4"])
|
||||
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("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_development_dependency("spork", ["~> 0.9.0.rc8"])
|
||||
s.add_development_dependency("cucumber", ["~> 0.10.0"])
|
||||
|
|
Loading…
Reference in a new issue