csslib
csslib copied to clipboard
Errors when parsing bulma.css
The following repro finds 6 errors in bulma/css/bulma.css
from:
https://github.com/jgthms/bulma/releases/tag/0.9.3
import 'dart:io';
import 'package:csslib/parser.dart';
const testOptions = PreprocessorOptions(
useColors: false,
checked: false,
warningsAsErrors: true,
inputFile: 'memory',
);
void main() {
final cssFile = File('bulma.css');
final css = cssFile.readAsStringSync();
final errors = <Message>[];
final stylesheet = parse(css, errors: errors, options: testOptions);
print(
'parsed ${stylesheet.topLevels.length} nodes with ${errors.length} errors');
}
The first error - which may be causing the others - is on:
.hero.is-white a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current),
^
.hero.is-white strong {
color: inherit;
}
I suspect this is related to https://github.com/dart-lang/csslib/issues/141 and our handling of pseudo selectors (:not()
). We're (mostly?) following the selector level 3 grammar - we don't support the newer selector level 4 grammar.