Search code examples
sencha-touchextjssencha-touch-2sasscompass-sass

Compass - Get width and height of generated sprite-map


I'm building a Sencha Touch mobile application and are using the functionality to create image-sprite-maps with Compass.

Is there any way to calculate the size of the image-map (width and height) and put it as a variable in your SCSS file?


Solution

  • In Compass, image-height and image-width are the functions to get image dimensions. Using them with your sprite map would look something like this (warning, untested):

    // Assuming $my-sprites is your sprite map variable
    $map-path: sprite-path($my-sprites);
    
    $map-height: image-height($map-path);
    $map-width: image-width($map-path);