home changes

This commit is contained in:
tdreyno 2009-10-26 15:42:06 -07:00
parent 58d6fc94ea
commit fcc4169b1d
6 changed files with 52 additions and 39 deletions

View file

@ -33,6 +33,11 @@ module Middleman
super
end
@@afters = []
def self.after(&block)
@@afters << block
end
# Rack helper for adding mime-types during local preview
def self.mime(ext, type)
ext = ".#{ext}" unless ext.to_s[0] == ?.
@ -80,10 +85,10 @@ end
# Haml is required & includes helpers
require "middleman/haml"
require "middleman/sass"
require 'sinatra/content_for'
require 'middleman/helpers'
require 'middleman/rack/static'
require 'middleman/rack/sprockets'
require "sinatra/content_for"
require "middleman/helpers"
require "middleman/rack/static"
require "middleman/rack/sprockets"
class Middleman::Base
helpers Sinatra::ContentFor
@ -92,10 +97,6 @@ class Middleman::Base
use Middleman::Rack::Static
use Middleman::Rack::Sprockets
enable :compass
require "middleman/features/compass"
@@features -= [:compass]
# Features disabled by default
disable :slickmap
disable :cache_buster
@ -127,10 +128,7 @@ class Middleman::Base
require "middleman/features/#{feature_name}"
end
::Compass.configuration do |config|
config.http_images_path = self.http_images_path rescue File.join(self.http_prefix, self.images_dir)
config.http_stylesheets_path = self.http_css_path rescue File.join(self.http_prefix, self.css_dir)
end
@@afters.each { |block| class_eval(&block) }
super
end

View file

@ -1,18 +0,0 @@
class Middleman::Base
configure do
::Compass.configuration do |config|
images_location = (self.environment == "build") ? self.build_dir : self.public
config.project_path = Dir.pwd
config.sass_dir = File.join(File.basename(self.views), self.css_dir)
config.output_style = :nested
config.css_dir = File.join(File.basename(images_location), self.css_dir)
config.images_dir = File.join(File.basename(images_location), self.images_dir)
# File.expand_path(self.images_dir, self.public)
config.add_import_path(config.sass_dir)
end
::Compass.configure_sass_plugin!
end
end

View file

@ -1,9 +1,5 @@
# Otherwise use YUI
# Fine a way to minify inline/css
class Middleman::Base
configure do
::Compass.configuration do |config|
config.output_style = :compressed
end
end
end

View file

@ -1,4 +1,5 @@
require "yui/compressor"
require "middleman/builder"
module Middleman
module Minified
@ -29,7 +30,7 @@ END
end
end
end
end if Middleman::Base.environment == "build"
end
end
Middleman::Base.supported_formats << "js"

View file

@ -0,0 +1,5 @@
require "middleman/rack/sprockets"
class Middleman::Base
use Middleman::Rack::Sprockets
end

View file

@ -1,5 +1,5 @@
require "sass"
require 'compass'
require "compass"
module Middleman
module Sass
@ -13,7 +13,7 @@ module Middleman
static_version = options.public + request.path_info
send_file(static_version) if File.exists? static_version
location_of_sass_file = options.environment == "build" ? File.join(options.build_dir, options.css_dir) : "public"
location_of_sass_file = options.environment == "build" ? options.build_dir : options.public
css_filename = File.join(Dir.pwd, location_of_sass_file) + request.path_info
sass(path.to_sym, ::Compass.sass_engine_options.merge({ :css_filename => css_filename }))
rescue Exception => e
@ -67,4 +67,35 @@ end
class Middleman::Base
include Middleman::Sass
configure do
::Compass.configuration do |config|
config.project_path = Dir.pwd
config.sass_dir = File.join(File.basename(self.views), self.css_dir)
config.output_style = :nested
config.css_dir = File.join(File.basename(self.public), self.css_dir)
config.images_dir = File.join(File.basename(self.public), self.images_dir)
config.add_import_path(config.sass_dir)
end
end
configure :build do
::Compass.configuration do |config|
config.css_dir = File.join(File.basename(self.build_dir), self.css_dir)
config.images_dir = File.join(File.basename(self.build_dir), self.images_dir)
end
end
after do
::Compass.configuration do |config|
config.http_images_path = self.http_images_path rescue File.join(self.http_prefix, self.images_dir)
config.http_stylesheets_path = self.http_css_path rescue File.join(self.http_prefix, self.css_dir)
config.asset_cache_buster do
false
end if !self.cache_buster?
end
::Compass.configure_sass_plugin!
end
end