Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return relative paths in result.map.sources - not absolute file:// URL #1185

Closed
milahu opened this issue Jan 7, 2021 · 1 comment
Closed

Comments

@milahu
Copy link

milahu commented Jan 7, 2021

dart-sass always returns absolute file URLs like file:///absolute/path/to/src/input.css
in the sources array of result.map
also when i enter relative filepaths like src/input.css

is there a way to get relative file paths in result.map.sources?

im looking for the equivalent of options.source_map_file_urls in libsass

// libsass/src/source_map.cpp

if (ctx.c_options.source_map_file_urls) {
  source = File::rel2abs(source);
  // check for windows abs path
  if (source[0] == '/') {
    // ends up with three slashes
    source = "file://" + source;
  } else {
    // needs an additional slash
    source = "file:///" + source;
  }
}

but i had no luck grepping through dart-sass sources

related to sass/node-sass#3057

@Awjin
Copy link
Contributor

Awjin commented Jan 8, 2021

This is a limitation inherent to the way that the JS API currently handles file paths. We're actively redesigning the API to allow for the use case that you describe here.

@Awjin Awjin closed this as completed Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants