mirror of
https://github.com/danog/dart-sass.git
synced 2025-01-22 22:02:00 +01:00
parent
fc8c987fc1
commit
a89c67b563
@ -1,5 +1,7 @@
|
||||
## 1.22.11
|
||||
|
||||
* Don't try to load unquoted plain-CSS indented-syntax imports.
|
||||
|
||||
* Fix a couple edge cases in `@extend` logic and related selector functions:
|
||||
|
||||
* Recognize `:matches()` and similar pseudo-selectors as superselectors of
|
||||
|
@ -9,6 +9,7 @@ import '../ast/sass.dart';
|
||||
import '../interpolation_buffer.dart';
|
||||
import '../logger.dart';
|
||||
import '../util/character.dart';
|
||||
import '../value.dart';
|
||||
import 'stylesheet.dart';
|
||||
|
||||
/// A parser for the indented syntax.
|
||||
@ -98,9 +99,21 @@ class SassParser extends StylesheetParser {
|
||||
scanner.readChar();
|
||||
next = scanner.peekChar();
|
||||
}
|
||||
var url = scanner.substring(start.position);
|
||||
var span = scanner.spanFrom(start);
|
||||
|
||||
return DynamicImport(parseImportUrl(scanner.substring(start.position)),
|
||||
scanner.spanFrom(start));
|
||||
if (isPlainImportUrl(url)) {
|
||||
// Serialize [url] as a Sass string because [StaticImport] expects it to
|
||||
// include quotes.
|
||||
return StaticImport(
|
||||
Interpolation([SassString(url).toString()], span), span);
|
||||
} else {
|
||||
try {
|
||||
return DynamicImport(parseImportUrl(url), span);
|
||||
} on FormatException catch (innerError) {
|
||||
error("Invalid URL: ${innerError.message}", span);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool scanElse(int ifIndentation) {
|
||||
|
@ -1002,7 +1002,7 @@ abstract class StylesheetParser extends Parser {
|
||||
var urlSpan = scanner.spanFrom(start);
|
||||
whitespace();
|
||||
var queries = tryImportQueries();
|
||||
if (_isPlainImportUrl(url) || queries != null) {
|
||||
if (isPlainImportUrl(url) || queries != null) {
|
||||
return StaticImport(
|
||||
Interpolation([urlSpan.text], urlSpan), scanner.spanFrom(start),
|
||||
supports: queries?.item1, media: queries?.item2);
|
||||
@ -1028,7 +1028,8 @@ abstract class StylesheetParser extends Parser {
|
||||
}
|
||||
|
||||
/// Returns whether [url] indicates that an `@import` is a plain CSS import.
|
||||
bool _isPlainImportUrl(String url) {
|
||||
@protected
|
||||
bool isPlainImportUrl(String url) {
|
||||
if (url.length < 5) return false;
|
||||
if (url.endsWith(".css")) return true;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user