A FileImporter<'sync'>
's findFileUrl must return synchronously, but in return it can be passed to compile and compileString in addition to compileAsync and compileStringAsync.
A FileImporter<'async'>
's findFileUrl may either return synchronously or asynchronously, but it can only be used with compileAsync and compileStringAsync.
Unlike an Importer, the compiler will automatically handle relative loads for a FileImporter. See Options.importers for more details on the way loads are resolved.
The loaded URL. Since this might be relative, it's represented as a string rather than a [[URL]] object.
Whether this is being invoked because of a Sass @import
rule, as opposed to a @use
or @forward
rule.
This should only be used for determining whether or not to load import-only files.
An absolute file:
URL if this importer recognizes the url
. This may be only partially resolved: the compiler will automatically look for partials, index files, and file extensions based on the returned URL. An importer may also return a fully resolved URL if it so chooses.
If this importer doesn't recognize the URL, it should return null
instead to allow other importers or load paths to handle it.
This may also return a Promise
, but if it does the importer may only be passed to compileAsync and compileStringAsync, not compile or compileString.
© 2006–2022 the Sass team, and numerous contributors
Licensed under the MIT License.
https://sass-lang.com/documentation/js-api/interfaces/FileImporter
A special type of importer that redirects all loads to existing files on disk. Although this is less powerful than a full Importer, it automatically takes care of Sass features like resolving partials and file extensions and of loading the file from disk.
Like all importers, this implements custom Sass loading logic for
@use
rules and@import
rules. It can be passed to Options.importers or StringOptionsWithImporter.importer.