////
/// @group tools/assets
////

/// Image URL
///
/// If a custom image-url handler is defined ($ccs-image-url-function) then
/// it will be called, otherwise a url will be returned with the filename
/// appended to the image path.
///
/// @param {String} Filename for the image to load
/// @return {String} URL for the filename, wrapped in `url()`
/// @access public

@function ccs-image-url($filename) {
  $use-custom-function: variable-exists("ccs-image-url-function")
    and $ccs-image-url-function
    and function-exists($ccs-image-url-function);

  @if $use-custom-function {
    @return call(get-function($ccs-image-url-function), $filename);
  } @else {
    @return url($ccs-images-path + $filename);
  }
}
