csslib icon indicating copy to clipboard operation
csslib copied to clipboard

Errors when parsing bulma.css

Open mit-mit opened this issue 3 years ago • 1 comments

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');
}

mit-mit avatar Sep 16 '21 09:09 mit-mit

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.

devoncarew avatar Jan 27 '23 20:01 devoncarew