Skip to content

Instantly share code, notes, and snippets.

@noopkat
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noopkat/10506922 to your computer and use it in GitHub Desktop.
Save noopkat/10506922 to your computer and use it in GitHub Desktop.
Sass Function extend
module Sass::Script::Functions
def getImg(string, url)
assert_type string, :String
assert_type url, :String
manifest = JSON.parse(File.read("manifest.json"))
Sass::Script::Value::String.new(url + "/" + manifest["img"][string])
end
declare :getImg, [:string]
end
/* usage in sass */
#stuff
background: url(getImg('unicorn.png', $s3url))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment