Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Windows problem: backslashes returned for css output #19

Closed
aproc opened this issue May 18, 2015 · 3 comments
Closed

Windows problem: backslashes returned for css output #19

aproc opened this issue May 18, 2015 · 3 comments
Labels

Comments

@aproc
Copy link

aproc commented May 18, 2015

I'm on a Windows machine and using postcss-assets. When I use resolve() in combination with the 'relativeTo' option, I receive double backslashes as css output instead of a simple /

/* source input: */
.selector { background-image: resolve('filename.png'); }
/* generated output: */
.selector { background-image: url('..\\images\\filename.png'); }
/* expected output: */
.selector { background-image: url('../images/filename.png'); }
@borodean borodean added the bug label May 18, 2015
@borodean
Copy link
Owner

Hi @aproc! Thanks for your feedback. I think I can fix it.

The only question is how to make it testable—Travis CI has no option for running tests on Windows.

@aproc
Copy link
Author

aproc commented May 19, 2015

Sorry, I'm not familar with Travis CI. I had a look at your code and tried a quick and dirty way to get the expected result after inspecting the output of cssesc(url.format(assetUrl)). But I'm not sure if it has any unwanted side effects. Maybe it helps?

/* index.js */
Assets.prototype.resolveUrl = function (assetStr) {
...
  /* line: 130 */
  return cssesc(url.format(assetUrl));

  /* change works on windows */
  return cssesc(url.format(assetUrl.path));
}

@borodean
Copy link
Owner

Fixed in 2.1.1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants