Compass: generate Sprites, plus width / height on each images in the sprite

前端 未结 2 1254
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-23 10:18

I\'m using Compass (a CSS Framework) to generate sprite images. It work, but compass generate only a background-position for each image.

Is it possible to get also t

相关标签:
2条回答
  • 2020-12-23 10:29

    I found the solution. Just pass true as the second argument :

    @include all-ico-sprites(true);
    

    Quite simply.

    0 讨论(0)
  • 2020-12-23 10:37

    This works:

    @include all-<map>-sprites(true);
    

    But you may want to consider the documented way of using configuration variables:
    http://compass-style.org/help/tutorials/spriting/

    You just specify the config variable before the import. In your case:

    $ico-sprite-dimensions: true;
    @import "ico/*png".
    @include all-ico-sprites;
    

    Sending true to the all include works, but as it's undocumented, it would seem that configuration variables are the preferred method.

    Aside from dimensions these are the other configuration variables available:

    $<map>-spacing           // space in px around the sprites
    $<map>-repeat            // whether to repeat the sprite bg
    $<map>-position          // the x position of the sprite on the map
    $<map>-sprite-base-class // the base class (default ".<map>-sprite")
    $<map>-clean-up          // whether to delete old image maps
    $<map>-<sprite>-spacing  // spacing, for individual sprites
    $<map>-<sprite>-repeat   // repeat, for individual sprites
    $<map>-<sprite>-position // position, for individual sprites
    
    0 讨论(0)
提交回复
热议问题