Skip to content

Instantly share code, notes, and snippets.

@marcelosomers
Created July 24, 2014 16:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcelosomers/6153098f7d3198b6138d to your computer and use it in GitHub Desktop.
Save marcelosomers/6153098f7d3198b6138d to your computer and use it in GitHub Desktop.
// ----
// Sass (v3.3.10)
// Compass (v1.0.0.alpha.20)
// ----
$base-path: "assets/" !default;
/**
* Asset handler
*
* @param {String} $type
* @param {String} $asset
*
* @requires {variable} base-path
*
* @return {String} Returns a `url()` function
*/
@function asset($type, $asset) {
@return url($base-path + $type + '/' + $asset);
}
/**
* Image helper
*
* @param {String} $image
*
* @requires {function} asset
*
* @return {String} Returns a `url()` function
*/
@function image($image) {
@return asset('images', $image);
}
test {
background: image('unicorn.jpg');
}
/**
* Asset handler
*
* @param {String} $type
* @param {String} $asset
*
* @requires {variable} base-path
*
* @return {String} Returns a `url()` function
*/
/**
* Image helper
*
* @param {String} $image
*
* @requires {function} asset
*
* @return {String} Returns a `url()` function
*/
test {
background: url("assets/images/unicorn.jpg");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment