Images

So you have some @2x images that you only want to show on retina devices, eh?

Just tag the image element with 'data-ui-component=retina-image' and a tiny JS component will automatically reference the '@2x' version of your image if the device supports it. You don't have to initialize this component. It's used too many places to require initialization on each page.

Do keep in mind that this component currently assumes the following:

  1. You are working with a `.png`
  2. The @2x version is stored in the same folder as the primary version.

as seen in employers/static/index.html.haml

Img Tags

Why one
%img.xs-mb1{alt: "Why one", "data-hidpi-src" => "/assets/employers/static/index/why-one@2x-b632c0c0885ebaee5f4dde74eda3ac10c6dcb1f4e104f3db6a5979b0d5a5f628.png", "data-ui-component" => "retina-image", src: "/assets/employers/static/index/why-one-6e88b2ee30b927328bb925547abc00c120a045d9e0fff03ead9891fb2d0d08bc.png"}/
<img class="xs-mb1" data-ui-component="retina-image" data-hidpi-src="/assets/employers/static/index/why-one@2x-b632c0c0885ebaee5f4dde74eda3ac10c6dcb1f4e104f3db6a5979b0d5a5f628.png" src="/assets/employers/static/index/why-one-6e88b2ee30b927328bb925547abc00c120a045d9e0fff03ead9891fb2d0d08bc.png" alt="Why one" />

Background Images

:css
  .demo-hero {
    height: 200px;
    width: 100%;
    background-image: url("../../../assets/employers/static/index/why-one.png");
    background-position: top center;
    background-repeat: no-repeat;
    background-size: contain; }
    .hidpi .demo-hero {
      background-image: url("../../../assets/employers/static/index/why-one@2x.png"); }
.demo-hero
<style>
  .demo-hero {
    height: 200px;
    width: 100%;
    background-image: url("../../../assets/employers/static/index/why-one.png");
    background-position: top center;
    background-repeat: no-repeat;
    background-size: contain; }
    .hidpi .demo-hero {
      background-image: url("../../../assets/employers/static/index/why-one@2x.png"); }
</style>
<div class='demo-hero'></div>
.demo-hero {
  background: {
    image: image-url('backgrounds/cool-thing.png');
    position: top center;
    repeat: no-repeat;
    size: contain;
  }

  .hidpi & {
    background: {
      image: image-url('backgrounds_2x/cool-thing.png');
    }
  }
}