aslansky / css-sprite

css sprite generator
MIT License
733 stars 55 forks source link

On Windows invalid css path is generated #8

Closed evilbloodydemon closed 10 years ago

evilbloodydemon commented 10 years ago

css-sprite uses path.join to make css path, and on windows path.join uses backslash so result is invalid, something like: background-image: url('\img\sprite.png');

Randle commented 10 years ago

There's a workaround for this issue, not too stylish, though working for me (I use SCSS): in css-sprite\lib\templates\sprite.js:

Original text:

// Render and return CSS var css = mustache.render(tmpl[options.processor], tmplParams);

replace with: var css = mustache.render(tmpl[options.processor], tmplParams).replace(/\/g, '/');

It changes all '\' into '/' in output. It's OK for scss syntax, though I do not know if '\' char is used in other syntaxes. Anyway best wishes to everyone and billions of thanks to authors.

DenysVuika commented 10 years ago

This issue is still valid with 0.9.0-beta2

adam-lynch commented 10 years ago

I fixed this :confused: #29

DenysVuika commented 10 years ago

I am generating plain css via gulp (however issue occurs even from command line) with the following options: name: 'somename', cssPath: '../img', prefix: 'icon-test' The resulting css always contains the following at the beginning (for Windows): .icon-test { background-image: url('..\img\somename.png'); }

aslansky commented 10 years ago

Adams fix is not released yet. Till the release you could use the git master instead of 0.9.0-beta2. In your package.json use:

"dependencies": { "css-sprite": "aslansky/css-sprite" }

DenysVuika commented 10 years ago

That makes sense now. Thanks.