twolfson / gulp.spritesmith

Convert a set of images into a spritesheet and CSS variables via gulp
The Unlicense
1.08k stars 81 forks source link

Resize imagen? #76

Closed rollrodrig closed 9 years ago

rollrodrig commented 9 years ago

Hello. This plugin is awesome i am working some proyects with it and it works great. Now i was wondering my self if is posible do something like this. `

            .logo_banca_simple {
                @include retina-sprite($logo-banca-simple);
                @media (max-width: 600){
                    // Is posible to do it?
                    // I need a small version of the logo
                    @include retina-sprite($logo-banca-simple * 0.8);
                }
            }

`

twolfson commented 9 years ago

Nope, there isn't anything built in spritesmith to handle that. There are a couple solutions I can think of for your problem:

.logo_banca_simple {
    @include retina-sprite($logo-banca-simple);
    @media (max-width: 600){
        .logo-banca-simple {
            background-size: ($logo-banca-simple-total-width * 0.8) ($logo-banca-simple-total-height * 0.8);
            background-position: ($logo-banca-simple-offset-x * 0.8) ($logo-banca-simple-offset-y * 0.8);
        }

         @media (-webkit-min-device-pixel-ratio: 2),
                 (min-resolution: 192dpi) {
            background-size: ($logo-banca-simple-2x-total-width * 0.8) ($logo-banca-simple-2x-total-height * 0.8);
            background-position: ($logo-banca-simple-2x-offset-x * 0.8) ($logo-banca-simple-2x-offset-y * 0.8);
        }
    }
}
rollrodrig commented 9 years ago

thank you.