aslansky / css-sprite

css sprite generator
MIT License
733 stars 55 forks source link

Retina sprite positions in SCSS are incorrect #47

Closed rseyferth closed 9 years ago

rseyferth commented 9 years ago

In the latest version (0.9.1), I get the coordinates in my SCSS file based on the retina size, instead of the regular size of the images, with the following gulp config:

return gulp.src('app/images/sprite/*.png')
        .pipe(sprite({
            base64: true,
            style: '_base64.scss',
            processor: 'scss',
            format: 'png',
            retina: true,
            prefix: 'sprite',
            orientation: 'vertical'
        }))
        .pipe(
            gulp.dest('app/styles'));

Instead of the correct coordinates:

$logo-footer: -2px -2px 67px 29px;

I get

$logo-footer: -4px -4px 134px 58px;

Am I doing something wrong, or should all the coordinates be divided by 2 when the retain option is on?

cappslock commented 9 years ago

I see this exact behavior. I downgraded to 0.9.0 and it worked. Curious to know the source of the problem and a better solution.

cappslock commented 9 years ago

In my case I'm using a custom template with minor modifications to the CSS processor, FWIW.

aslansky commented 9 years ago

Mh strange. The test seem to be fine and actually the code for calculating the positions didn't change. I'll look into it.

cappslock commented 9 years ago

Yeah I'm not sure... I'm not doing anything too wacky but I'm happy to provide my gulp task config and previous/post output if it's helpful.

aslansky commented 9 years ago

This was a nice one. Due to the update of lodash to the new 3 version something like lodash(somearray).each() doesn't work anymore. Unfortunately that failed without any error :(

aslansky commented 9 years ago

Fixed in 0.9.2

message commented 9 years ago

Does npm need time to update? npm ERR! version not found: css-sprite@0.9.2

aslansky commented 9 years ago

I am not sure what's going on. npm info tells me:

versions: [ '0.4.0', '0.5.0', ... '0.9.0-beta2', '0.9.0', '0.9.1' ], time: { modified: '2015-02-05T17:58:49.101Z', created: '2014-02-09T01:05:34.326Z', '0.4.0': '2014-02-09T01:05:34.326Z', .... '0.9.0': '2014-11-16T19:46:44.028Z', '0.9.1': '2015-02-05T09:20:29.862Z', '0.9.2': '2015-02-05T17:48:48.849Z' },

cappslock commented 9 years ago

Looks unpublished to me, see output from http://registry.npmjs.org/css-sprite

aslansky commented 9 years ago

Mh so I guess I have to publish 0.9.3. Because I can't do it with 0.9.2 anymore.

❯ npm publish npm ERR! publish Failed PUT 403 npm ERR! Error: forbidden Attempting to modify version 0.9.2, npm ERR! which was previously published on 2015-02-05T17:48:48.849Z.

aslansky commented 9 years ago

The package is online http://registry.npmjs.org/css-sprite/-/css-sprite-0.9.2.tgz, so I guess it's just a caching issue. I will wait till the morning and if nothing happens I republish with a new version number.

cappslock commented 9 years ago

Yeah, I've seen that before with npm. You can open an issue with them, they're usually pretty responsive.

On Thu, Feb 5, 2015 at 3:18 PM, Alexander Slansky notifications@github.com wrote:

The package is online http://registry.npmjs.org/css-sprite/-/css-sprite-0.9.2.tgz, so I guess it's just a caching issue. I will wait till the morning and if nothing happens I republish with a new version number.

— Reply to this email directly or view it on GitHub https://github.com/aslansky/css-sprite/issues/47#issuecomment-73130750.

aslansky commented 9 years ago

Yeah, I opened an issue with them, because the module is also gone from my profile page on npmjs.com. Let's hope the problems gets resolved quickly.

message commented 9 years ago

Any news?

aslansky commented 9 years ago

I published 0.9.3 a few minutes ago and it's available. So your good to go.