fix relative compass paths

This commit is contained in:
tdreyno 2009-08-11 16:26:08 -07:00
parent 13a9fbdf99
commit 492b01b4ea
2 changed files with 10 additions and 3 deletions

View file

@ -20,7 +20,9 @@ module Generators
# Override template to ask staticmatic for the correct extension to output # Override template to ask staticmatic for the correct extension to output
def self.template(name, *args, &block) def self.template(name, *args, &block)
return if args.first.include?('layout') return if args.first.include?('layout')
return if File.basename(args.first)[0,1] == '_' args.first.split('/').each do |part|
return if part[0,1] == '_'
end
if (args[0] === args[1]) if (args[0] === args[1])
newext = case File.extname(args.first) newext = case File.extname(args.first)

View file

@ -49,8 +49,11 @@ class Middleman < Sinatra::Base
config.project_path = Dir.pwd config.project_path = Dir.pwd
config.sass_dir = File.join(File.basename(self.views), "stylesheets") config.sass_dir = File.join(File.basename(self.views), "stylesheets")
config.output_style = :nested config.output_style = :nested
config.css_dir = File.join(File.basename(self.public), "stylesheets")
config.images_dir = File.join(File.basename(self.public), "images") config.images_dir = File.join(File.basename(self.public), "images")
config.http_images_path = "/images/" config.http_path = "/"
config.http_images_path = "/images"
config.http_stylesheets_path = "/stylesheets"
config.add_import_path(config.sass_dir) config.add_import_path(config.sass_dir)
end end
end end
@ -73,7 +76,9 @@ class Middleman < Sinatra::Base
get %r{/(.*).css} do |path| get %r{/(.*).css} do |path|
content_type 'text/css', :charset => 'utf-8' content_type 'text/css', :charset => 'utf-8'
begin begin
sass(path.to_sym, Compass.sass_engine_options) location_of_sass_file = defined?(MIDDLEMAN_BUILDER) ? "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 rescue Exception => e
sass_exception_string(e) sass_exception_string(e)
end end