sass/dart-sass

Properly support UNC paths on the command line

Opened this issue · 5 comments

As a new feature of the project trunk we auto-download dart-sass to the local device and then execute it as one of our pipelines. Before we used a directly compiled library that integrates with libsass but as that's deprecated we want to move to dart-sass.

In Rust, paths are quickly turned into UNC paths like \\?\C:\Users\Me\... through stdlib logic. We try to turn them back into the legacy-style C:\Users\Me\... paths but that may not always work due to path length limits and so on.

Therefore, it would be great if dart-sass could support UNC paths for input/output files.

Sass operates on URLs, not on paths, so we don't plan to add support for any OS-specific paths. If you're converting paths into another format anyway, should you instead convert to a file URL.

I tried out using dart-sass with file URLs now and they don't work neither. Just to clarify, I'm talking about paths to files in the terminal that are passed to dart-sass and not import statements or anything alike.

So I added a conversion step before calling dart-sass, now passing file:///.... instead and that works neither on UNIX nor Windows systems. It fails with Duplicate source "file". similar to the problem with UNC paths.

I think the actual problem is the <input>:<output> syntax so it misunderstands anything with a colon as this mapping.

Ah, I see. I misread this as an issue with using the API, not the command line. OS paths passed on the command line should indeed be converted to URLs, so I'll reopen this, targeted to fixing that for UNC paths

Awjin commented

Dart's path package currently does not support the \\?\ prefix for UNC paths. I've filed a bug with the path repo here: dart-lang/path#106.