load method
Loads the Sass text for the given url
, or returns null
if
this importer can't find the stylesheet it refers to.
The url
comes from a call to canonicalize for this importer.
When Sass encounters an @import
rule in a stylesheet, it first calls
canonicalize and load on the importer that first loaded that
stylesheet with the imported URL resolved relative to the stylesheet's
original URL. If either of those returns null
, it then calls
canonicalize and load on each importer in order with the URL as it
appears in the @import
rule.
If the importer finds a stylesheet at url
but it fails to load for some
reason, or if url
is uniquely associated with this importer but doesn't
refer to a real stylesheet, the importer may throw an exception that will
be wrapped by Sass. If the exception object has a message
property, it
will be used as the wrapped exception's message; otherwise, the exception
object's toString()
will be used. This means it's safe for importers to
throw plain strings.
Implementation
ImporterResult? load(Uri url) {
var path = p.fromUri(url);
return ImporterResult(io.readFile(path),
sourceMapUrl: url, syntax: Syntax.forPath(path));
}