Skip to content

Commit

Permalink
Improve the error message for invalid default namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
stof committed Sep 28, 2021
1 parent ba38c09 commit 0490f9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/src/importer/legacy_node.dart
Expand Up @@ -2,4 +2,5 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

export 'legacy_node/interface.dart' if (dart.library.js) 'legacy_node/implementation.dart';
export 'legacy_node/interface.dart'
if (dart.library.js) 'legacy_node/implementation.dart';
6 changes: 5 additions & 1 deletion lib/src/parse/stylesheet.dart
Expand Up @@ -1398,7 +1398,11 @@ abstract class StylesheetParser extends Parser {
try {
return Parser.parseIdentifier(namespace, logger: logger);
} on SassFormatException {
error('Invalid Sass identifier "$namespace"', scanner.spanFrom(start));
error(
'The default namespace "$namespace" is not a valid Sass identifier.\n'
"\n"
'Recommendation: add an "as" clause to define an explicit namespace.',
scanner.spanFrom(start));
}
}

Expand Down

0 comments on commit 0490f9e

Please sign in to comment.