FilesystemImporter
public protocol FilesystemImporter: Sendable
Methods required to implement a filesystem-redirecting stylesheet importer.
Use this to map imports to a filesystem location, letting the Sass compiler deal with index directories, file extensions, and actually loading the stylesheet.
Topics
func resolve(ruleURL: String, context: ImporterContext) async -> URL?
func resolve(ruleURL: String, context: ImporterContext) async -> URL?
Resolve an imported URL to a filesystem location.
Declaration
func resolve(ruleURL: String, context: ImporterContext) async throws -> URL?
Parameters
ruleURL |
The text following |
context |
Some details about the import to help resolve it.
You are free to ignore the |
Throws
Only when ruleURL
cannot be resolved: it is definitely
this importer’s responsibility to do so, but it can’t.
Compilation will stop, quoting the description of the error thrown as the reason.
Return Value
A file:
URL for the compiler to access, or nil
if the importer doesn’t recognize the
import request: the compiler will try the next importer.