/
importer.dart
43 lines (36 loc) · 1.47 KB
/
importer.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2017 Google Inc. Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
import 'importer/async.dart';
import 'importer/no_op.dart';
import 'importer/result.dart';
export 'importer/async.dart';
export 'importer/filesystem.dart';
export 'importer/package.dart';
export 'importer/result.dart';
/// An interface for importers that resolves URLs in `@import`s to the contents
/// of Sass files.
///
/// Importers should override [toString] to provide a human-readable description
/// of the importer. For example, the default filesystem importer returns its
/// load path.
///
/// This extends [AsyncImporter] to guarantee that [canonicalize] and [load] are
/// synchronous. It's usable with both the synchronous and asynchronous
/// `compile()` functions, and as such should be extended in preference to
/// [AsyncImporter] if possible.
///
/// Subclasses should extend [Importer], not implement it.
///
/// {@category Importer}
abstract class Importer extends AsyncImporter {
/// An importer that never imports any stylesheets.
///
/// This is used for stylesheets which don't support relative imports, such as
/// those created from Dart code with plain strings.
static final Importer noOp = NoOpImporter();
Uri? canonicalize(Uri url);
ImporterResult? load(Uri url);
DateTime modificationTime(Uri url) => DateTime.now();
bool couldCanonicalize(Uri url, Uri canonicalUrl) => true;
}