compile function

StyleSheet compile(
  1. Object input,
  2. {List<Message>? errors,
  3. PreprocessorOptions? options,
  4. bool nested = true,
  5. bool polyfill = false,
  6. List<StyleSheet>? includes}
)

Parse and analyze the CSS file.

Implementation

StyleSheet compile(Object input,
    {List<Message>? errors,
    PreprocessorOptions? options,
    bool nested = true,
    bool polyfill = false,
    List<StyleSheet>? includes}) {
  includes ??= [];

  var source = _inputAsString(input);

  _createMessages(errors: errors, options: options);

  var file = SourceFile.fromString(source);

  var tree = _Parser(file, source).parse();

  analyze([tree], errors: errors, options: options);

  if (polyfill) {
    var processCss = PolyFill(messages);
    processCss.process(tree, includes: includes);
  }

  return tree;
}