prepare pre-1.0 release
This commit is contained in:
parent
1a975efa61
commit
a3f4e73f61
|
@ -30,7 +30,9 @@ module Generators
|
|||
if (args[0] === args[1])
|
||||
args[1] = args[0].gsub("#{File.basename(Middleman::Base.views)}/", "")
|
||||
.gsub("#{File.basename(Middleman::Base.public)}/", "")
|
||||
args[1] = args[1].gsub!(File.extname(args[1]), "") if File.basename(args[1]).split('.').length > 2
|
||||
if File.extname(args[1]) != ".js"
|
||||
args[1] = args[1].gsub!(File.extname(args[1]), "") if File.basename(args[1]).split('.').length > 2
|
||||
end
|
||||
end
|
||||
|
||||
super(name, *args, &block)
|
||||
|
|
|
@ -32,7 +32,7 @@ module Middleman
|
|||
enable :minify_css
|
||||
enable :minify_javascript
|
||||
enable :cache_buster
|
||||
disable :slickmap
|
||||
# disable :slickmap
|
||||
end
|
||||
|
||||
def template_exists?(path, renderer=nil)
|
||||
|
|
|
@ -3,11 +3,13 @@ require 'compass'
|
|||
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 = minify_css ? :compressed : :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.output_style = self.minify_css? ? :compressed : :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)
|
||||
|
||||
if !cache_buster?
|
||||
|
|
|
@ -2,6 +2,7 @@ module Middleman
|
|||
module Haml
|
||||
def self.included(base)
|
||||
base.supported_formats << "haml"
|
||||
# base.helpers Middleman::HamlHelpers
|
||||
end
|
||||
|
||||
def render_path(path)
|
||||
|
@ -20,43 +21,43 @@ module Middleman
|
|||
end
|
||||
end
|
||||
|
||||
# module Helpers
|
||||
# def haml_partial(name, options = {})
|
||||
# item_name = name.to_sym
|
||||
# counter_name = "#{name}_counter".to_sym
|
||||
# if collection = options.delete(:collection)
|
||||
# collection.enum_for(:each_with_index).collect do |item,index|
|
||||
# haml_partial name, options.merge(:locals => {item_name => item, counter_name => index+1})
|
||||
# end.join
|
||||
# elsif object = options.delete(:object)
|
||||
# haml_partial name, options.merge(:locals => {item_name => object, counter_name => nil})
|
||||
# else
|
||||
# haml "_#{name}".to_sym, options.merge(:layout => false)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
module HamlHelpers
|
||||
def haml_partial(name, options = {})
|
||||
item_name = name.to_sym
|
||||
counter_name = "#{name}_counter".to_sym
|
||||
if collection = options.delete(:collection)
|
||||
collection.enum_for(:each_with_index).collect do |item,index|
|
||||
haml_partial name, options.merge(:locals => {item_name => item, counter_name => index+1})
|
||||
end.join
|
||||
elsif object = options.delete(:object)
|
||||
haml_partial name, options.merge(:locals => {item_name => object, counter_name => nil})
|
||||
else
|
||||
haml "_#{name}".to_sym, options.merge(:layout => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# module Table
|
||||
# include ::Haml::Filters::Base
|
||||
#
|
||||
# def render(text)
|
||||
# output = '<div class="table"><table cellspacing="0" cellpadding="0">'
|
||||
# line_num = 0
|
||||
# text.each_line do |line|
|
||||
# line_num += 1
|
||||
# next if line.strip.empty?
|
||||
# output << %Q{<tr class="#{(line_num % 2 == 0) ? "even" : "odd" }#{(line_num == 1) ? " first" : "" }">}
|
||||
#
|
||||
# columns = line.split("|").map { |p| p.strip }
|
||||
# columns.each_with_index do |col, i|
|
||||
# output << %Q{<td class="col#{i+1}">#{col}</td>}
|
||||
# end
|
||||
#
|
||||
# output << "</tr>"
|
||||
# end
|
||||
# output + "</table></div>"
|
||||
# end
|
||||
# end
|
||||
module Table
|
||||
include ::Haml::Filters::Base
|
||||
|
||||
def render(text)
|
||||
output = '<div class="table"><table cellspacing="0" cellpadding="0">'
|
||||
line_num = 0
|
||||
text.each_line do |line|
|
||||
line_num += 1
|
||||
next if line.strip.empty?
|
||||
output << %Q{<tr class="#{(line_num % 2 == 0) ? "even" : "odd" }#{(line_num == 1) ? " first" : "" }">}
|
||||
|
||||
columns = line.split("|").map { |p| p.strip }
|
||||
columns.each_with_index do |col, i|
|
||||
output << %Q{<td class="col#{i+1}">#{col}</td>}
|
||||
end
|
||||
|
||||
output << "</tr>"
|
||||
end
|
||||
output + "</table></div>"
|
||||
end
|
||||
end
|
||||
|
||||
module Sass
|
||||
def self.included(base)
|
||||
|
@ -69,7 +70,7 @@ module Middleman
|
|||
static_version = options.public + request.path_info
|
||||
send_file(static_version) if File.exists? static_version
|
||||
|
||||
location_of_sass_file = defined?(MIDDLEMAN_BUILDER) ? "build" : "views"
|
||||
location_of_sass_file = options.environment == "build" ? "build" : "views"
|
||||
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
|
||||
|
|
|
@ -1,19 +1,27 @@
|
|||
class Middleman::Base
|
||||
if compass?
|
||||
configure do
|
||||
::Compass.configuration do |config|
|
||||
config.relative_assets = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# config.relative_assets = true
|
||||
|
||||
def asset_url(path)
|
||||
if path.include?("://")
|
||||
path
|
||||
else
|
||||
request_path = request.path_info.dup
|
||||
request_path << "index.html" if path.match(%r{/$})
|
||||
request_path.gsub!(%r{^/}, '')
|
||||
parts = request_path.split('/')
|
||||
|
||||
if parts.length > 1
|
||||
"../" * (parts.length - 1) + path
|
||||
else
|
||||
helpers do
|
||||
def asset_url(path)
|
||||
if path.include?("://")
|
||||
path
|
||||
else
|
||||
request_path = request.path_info.dup
|
||||
request_path << "index.html" if path.match(%r{/$})
|
||||
request_path.gsub!(%r{^/}, '')
|
||||
parts = request_path.split('/')
|
||||
|
||||
if parts.length > 1
|
||||
"../" * (parts.length - 1) + path
|
||||
else
|
||||
path
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,18 +1,5 @@
|
|||
module Middleman
|
||||
module Helpers
|
||||
def find_and_include_related_css_file
|
||||
path = request.path_info.dup
|
||||
path << "index.html" if path.match(%r{/$})
|
||||
path.gsub!(%r{^/}, '')
|
||||
path.gsub!(File.extname(path), '')
|
||||
path.gsub!('/', '-')
|
||||
|
||||
sass_file = File.join(File.basename(self.class.views), "stylesheets", "#{path}.sass")
|
||||
if File.exists? sass_file
|
||||
stylesheet_link_tag "stylesheets/#{path}.css"
|
||||
end
|
||||
end
|
||||
|
||||
def page_classes(*additional)
|
||||
path = request.path_info
|
||||
path << "index.html" if path.match(%r{/$})
|
||||
|
|
Loading…
Reference in a new issue