mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
home changes
This commit is contained in:
parent
58d6fc94ea
commit
fcc4169b1d
6 changed files with 52 additions and 39 deletions
|
@ -33,6 +33,11 @@ module Middleman
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@@afters = []
|
||||||
|
def self.after(&block)
|
||||||
|
@@afters << block
|
||||||
|
end
|
||||||
|
|
||||||
# Rack helper for adding mime-types during local preview
|
# Rack helper for adding mime-types during local preview
|
||||||
def self.mime(ext, type)
|
def self.mime(ext, type)
|
||||||
ext = ".#{ext}" unless ext.to_s[0] == ?.
|
ext = ".#{ext}" unless ext.to_s[0] == ?.
|
||||||
|
@ -80,10 +85,10 @@ end
|
||||||
# Haml is required & includes helpers
|
# Haml is required & includes helpers
|
||||||
require "middleman/haml"
|
require "middleman/haml"
|
||||||
require "middleman/sass"
|
require "middleman/sass"
|
||||||
require 'sinatra/content_for'
|
require "sinatra/content_for"
|
||||||
require 'middleman/helpers'
|
require "middleman/helpers"
|
||||||
require 'middleman/rack/static'
|
require "middleman/rack/static"
|
||||||
require 'middleman/rack/sprockets'
|
require "middleman/rack/sprockets"
|
||||||
|
|
||||||
class Middleman::Base
|
class Middleman::Base
|
||||||
helpers Sinatra::ContentFor
|
helpers Sinatra::ContentFor
|
||||||
|
@ -92,10 +97,6 @@ class Middleman::Base
|
||||||
use Middleman::Rack::Static
|
use Middleman::Rack::Static
|
||||||
use Middleman::Rack::Sprockets
|
use Middleman::Rack::Sprockets
|
||||||
|
|
||||||
enable :compass
|
|
||||||
require "middleman/features/compass"
|
|
||||||
@@features -= [:compass]
|
|
||||||
|
|
||||||
# Features disabled by default
|
# Features disabled by default
|
||||||
disable :slickmap
|
disable :slickmap
|
||||||
disable :cache_buster
|
disable :cache_buster
|
||||||
|
@ -127,10 +128,7 @@ class Middleman::Base
|
||||||
require "middleman/features/#{feature_name}"
|
require "middleman/features/#{feature_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
::Compass.configuration do |config|
|
@@afters.each { |block| class_eval(&block) }
|
||||||
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
|
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
|
|
@ -1,9 +1,5 @@
|
||||||
# Otherwise use YUI
|
# Otherwise use YUI
|
||||||
# Fine a way to minify inline/css
|
# Fine a way to minify inline/css
|
||||||
class Middleman::Base
|
::Compass.configuration do |config|
|
||||||
configure do
|
|
||||||
::Compass.configuration do |config|
|
|
||||||
config.output_style = :compressed
|
config.output_style = :compressed
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
|
@ -1,4 +1,5 @@
|
||||||
require "yui/compressor"
|
require "yui/compressor"
|
||||||
|
require "middleman/builder"
|
||||||
|
|
||||||
module Middleman
|
module Middleman
|
||||||
module Minified
|
module Minified
|
||||||
|
@ -29,7 +30,7 @@ END
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end if Middleman::Base.environment == "build"
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Middleman::Base.supported_formats << "js"
|
Middleman::Base.supported_formats << "js"
|
5
lib/middleman/features/sprockets.rb
Normal file
5
lib/middleman/features/sprockets.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require "middleman/rack/sprockets"
|
||||||
|
|
||||||
|
class Middleman::Base
|
||||||
|
use Middleman::Rack::Sprockets
|
||||||
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
require "sass"
|
require "sass"
|
||||||
require 'compass'
|
require "compass"
|
||||||
|
|
||||||
module Middleman
|
module Middleman
|
||||||
module Sass
|
module Sass
|
||||||
|
@ -13,7 +13,7 @@ module Middleman
|
||||||
static_version = options.public + request.path_info
|
static_version = options.public + request.path_info
|
||||||
send_file(static_version) if File.exists? static_version
|
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
|
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 }))
|
sass(path.to_sym, ::Compass.sass_engine_options.merge({ :css_filename => css_filename }))
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
|
@ -67,4 +67,35 @@ end
|
||||||
|
|
||||||
class Middleman::Base
|
class Middleman::Base
|
||||||
include Middleman::Sass
|
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
|
end
|
Loading…
Reference in a new issue