lib/cytoplasm.rb in cytoplasm-0.1.4 vs lib/cytoplasm.rb in cytoplasm-0.1.5
- old
+ new
@@ -249,10 +249,11 @@
end
end
end
when "css"
deps << "http://ajax.googleapis.com/ajax/libs/jqueryui/"+conf("jqueryui.version")+"/themes/"+conf("jqueryui.theme")+"/jquery-ui.css"
+ deps += load_fonts()
#deps << "cytoplasm/cytoplasm-"+Time.now.to_i.to_s
@dependencies[:css].each do |stylesheet|
deps << "cytoplasm/"+stylesheet
end
when "js"
@@ -308,9 +309,31 @@
args = direction+", "+args.reverse().join(", ")
output += "@#{parent}#{k}_reverse:linear-gradient(#{args});\n"
end
return output
end
+ end
+
+ def self.load_fonts
+ sheets = []
+ begin
+ enabled = YAML::load_file("public/fonts/enabled.yml")
+ rescue
+ puts "Failed to parse YAML in public/fonts/enabled.yml!"
+ end
+ enabled.each do |dir,fonts|
+ fonts.each do |fam,variants|
+ if dir == "fontsquirrel"
+ sheets << "/fonts/"+fam+"/stylesheet.css"
+ elsif dir == "googlewebfonts"
+ sheet = "http://fonts.googleapis.com/css?family="+fam
+ sheet += ":" + variants.join(",") if variants.any?
+ sheets << sheet
+ end
+ #sheets << ((dir == "fontsquirrel") ? "/fonts/"+fam+"/stylesheet.css" : "http://fonts.googleapis.com/css?family="+fam)
+ end
+ end
+ return sheets
end
# Instantiate engine
module Rails
class Engine < ::Rails::Engine
\ No newline at end of file