visitImportDirective method

  1. @override
void visitImportDirective(
  1. ImportDirective node
)
override

Implementation

@override
void visitImportDirective(ImportDirective node) {
  bool isStartingQuote(String ch) => '\'"'.contains(ch[0]);

  if (_isTesting) {
    // Emit assuming url() was parsed; most suite tests use url function.
    emit('@import url(${node.import})');
  } else if (isStartingQuote(node.import)) {
    emit('@import ${node.import}');
  } else {
    // url(...) isn't needed only a URI can follow an @import directive; emit
    // url as a string.
    emit('@import "${node.import}"');
  }
  emitMediaQueries(node.mediaQueries);
  _emitSemicolon(forceLf: true);
}