URLStyle

Swift
public enum URLStyle

How to reference source map resources from CSS.

There are two references here: the CSS pointing at the source map, and the source map pointing at the original sources. The Sass compiler uses absolute (typically file:) URLs for original sources. This can be modified and the CSS -> source map reference added using CompilerResults.withFileLocations(...).

If you plan to ship the source map (so it is accessed through http: URLs by a browser) then you need to use one of the .relative options to avoid file: URLs that won’t make sense to clients.


Topics

case allAbsolute

Use absolute (file: for filesystem files) URLs everywhere.

Declaration
Swift
case allAbsolute

case sourcesAbsolute

Use absolute URLs in the source map to refer to the original sources, but use a relative URL to refer to the source map from the CSS.

Declaration
Swift
case sourcesAbsolute

case relative

Use relative URLs everywhere possible. For example if an original source is referenced with an https: or data: URL then that version is preserved.

Declaration
Swift
case relative

case relativeSourceRoot(String)

Like relative, but also set the sourceRoot source map field to add extra path segments between the source map and the original sources.

Declaration
Swift
case relativeSourceRoot(String)