works now

This commit is contained in:
tdreyno 2010-03-02 21:50:33 -08:00
parent ccbc3cf46f
commit 65925fc0e5
2 changed files with 17 additions and 18 deletions

View file

@ -157,6 +157,7 @@ class Middleman::Base
configure :build do configure :build do
end end
def self.new(*args, &block)
# Check for and evaluate local configuration # Check for and evaluate local configuration
local_config = File.join(self.root, "init.rb") local_config = File.join(self.root, "init.rb")
if File.exists? local_config if File.exists? local_config
@ -165,16 +166,6 @@ class Middleman::Base
set :app_file, File.expand_path(local_config) set :app_file, File.expand_path(local_config)
end end
# use Rack::Static, :urls => [/.*/], :root => Middleman::Base.public
# use Rack::Static, :urls => [/.*/], :root => Middleman::Base.views
# use Middleman::Rack::Static
use Middleman::Rack::Sprockets, :root => Middleman::Base.root,
:load_path => [ File.join("public", Middleman::Base.js_dir),
File.join("views", Middleman::Base.js_dir) ]
use Middleman::Rack::MinifyJavascript
use Middleman::Rack::MinifyCSS
def self.new(*args, &block)
# loop over enabled feature # loop over enabled feature
features.flatten.each do |feature_name| features.flatten.each do |feature_name|
next unless send(:"#{feature_name}?") next unless send(:"#{feature_name}?")
@ -186,6 +177,14 @@ class Middleman::Base
end end
end end
use Middleman::Rack::MinifyJavascript if minify_javascript?
use Middleman::Rack::MinifyCSS if minify_css?
# Built-in javascript combination
use Middleman::Rack::Sprockets, :root => Middleman::Base.root,
:load_path => [ File.join("public", Middleman::Base.js_dir),
File.join("views", Middleman::Base.js_dir) ]
@@afters.each { |block| class_eval(&block) } @@afters.each { |block| class_eval(&block) }
super super

View file

@ -12,7 +12,7 @@ class Middleman::Rack::MinifyJavascript
def call(env) def call(env)
status, headers, response = @app.call(env) status, headers, response = @app.call(env)
if Middleman::Base.enabled?(:minify_javascript) && env["PATH_INFO"].match(/\.js$/) if env["PATH_INFO"].match(/\.js$/)
compressor = ::YUI::JavaScriptCompressor.new(:munge => true) compressor = ::YUI::JavaScriptCompressor.new(:munge => true)
uncompressed_source = response.is_a?(::Rack::File) ? File.read(response.path) : response uncompressed_source = response.is_a?(::Rack::File) ? File.read(response.path) : response