$image-url-base: "_images" !default


@import "cannot/hires"


@function image-url($name, $scale, $format)
  @if $scale == 1x
    @return url(#{$image-url-base}/#{$name}.#{$format})
  @return url(#{$image-url-base}/#{$name}@#{$scale}.#{$format})

@mixin background-image-hires($url)
  @include hires
    background-image: $url

@mixin image($name, $format, $double: false)
  $hires-scale: 2x
  $scale: 1x
  @if $double
    $hires-scale: 4x
    $scale: 2x
  @if $format != svg
    @include background-image-hires(image-url($name, $hires-scale, $format))
  background-image: image-url($name, $scale, $format)
  background-repeat: no-repeat
