importOptions method

ImportOptions importOptions ()

For @import(options) returns the activated options. Example:

@import (less, multiple) "file.css";

returns {less: true, multiple: true}

Implementation

ImportOptions importOptions() {
  String o;
  String optionName;
  final ImportOptions options = ImportOptions();
  bool value;

  // list of options, surrounded by parens
  if (parserInput.$char('(') == null) return null;

  do {
    o = importOption();
    if (o != null) {
      optionName = o;
      value = true;
      switch (optionName) {
        case 'css':
          optionName = 'less';
          value = false;
          break;
        case 'once':
          optionName = 'multiple';
          value = false;
          break;
      }
      options[optionName] = value;
      if (parserInput.$char(',') == null) break;
    }
  } while (o != null);
  parserInput.expectChar(')');
  return options;
}