Sha256: c3f416fc1a6443a5ddc7159cb9cb69954b1069586fce84accac371e623e1828d
Contents?: true
Size: 984 Bytes
Versions: 3
Compression:
Stored size: 984 Bytes
Contents
require "sass" module Sass::Script::Functions def twbs_font_path(path) assert_type path, :String path = path.value.sub /[?#].*/, "" contents = Prez::Files.contents path, "font" extension = path[/\.([^.]*)$/, 1] case extension when "eot" font_type = "application/vnd.ms-fontobject" when "svg" font_type = "image/svg+xml" when "ttf" font_type = "font/ttf" when "woff" font_type = "application/font-woff" when "woff2" font_type = "application/font-woff2" else raise Prez::Error.new("Unknown font extension '#{extension}'") end Sass::Script::Value::String.new Prez::DataUri.new(font_type, contents).to_s rescue Prez::Files::MissingError => e raise Prez::Error.new("Could not find font: '#{path}'") end def twbs_image_path(path) Sass::Script::Value::String.new("ARGLE BARGLE IMAGE #{path.inspect}") end declare :twbs_font_path, [:path] declare :twbs_image_path, [:path] end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
prez-0.1.2 | lib/prez/sass_extensions.rb |
prez-0.1.1 | lib/prez/sass_extensions.rb |
prez-0.1.0 | lib/prez/sass_extensions.rb |