visitNamespaceDirective method

  1. @override
void visitNamespaceDirective(
  1. NamespaceDirective node
)
override

Implementation

@override
void visitNamespaceDirective(NamespaceDirective node) {
  bool isStartingQuote(String ch) => ('\'"'.contains(ch));

  if (isStartingQuote(node._uri!)) {
    emit(' @namespace ${node.prefix}"${node._uri}"');
  } else {
    if (_isTesting) {
      // Emit exactly was we parsed.
      emit(' @namespace ${node.prefix}url(${node._uri})');
    } else {
      // url(...) isn't needed only a URI can follow a:
      //    @namespace prefix directive.
      emit(' @namespace ${node.prefix}${node._uri}');
    }
  }
  emit(';');
}