def css_from_assignments(assignments = {})
assignments ||= self.class_assignments
output_css = {}
blueprint_assignments = CSSParser.new(File.path_to_string(self.source_file)).parse
assignments.each do |semantic_class, blueprint_classes|
blueprint_classes = blueprint_classes.split(/,|\s/).find_all {|c| !c.blank? }.flatten.map {|c| c.strip }
classes = []
blueprint_classes.each do |bp_class|
match = bp_class.include?('.') ? bp_class.gsub(".", ".#{self.namespace}") : ".#{self.namespace}#{bp_class}"
classes << blueprint_assignments.find_all {|line| line[:tags] =~ Regexp.new(/^([\w\.\-]+, ?)*#{match}(, ?[\w\.\-]+)*$/) }.uniq
end
classes = classes.flatten.uniq
output_css[semantic_class] = "#{classes.sort_by {|i| i[:idx]}.map {|i| i[:rules]}}"
end
css = ""
output_css.each do |tags, rules|
css += "#{tags} {#{rules}}\n"
end
css
end