code: function correctSourceOrder(root) {
    var sortedRoot = _postcss2.default.root();
    var clone = root.clone();
    clone.walkRules(function (rule) {
      var start = rule.source.start.line;
      if (rule.parent.type === 'atrule') {
        var child = rule;
        rule = _postcss2.default.atRule({
          name: rule.parent.name,
          params: rule.parent.params
        }).append(rule.clone());
        rule.source = child.source;
        start = child.source.start.line;
      }
      if (sortedRoot.nodes.length === 0 || sortedRoot.last && sortedRoot.last.source.start.line > start) {
        sortedRoot.prepend(rule);
      } else {
        sortedRoot.append(rule);
      }
    });
    return sortedRoot;
  }
docs: Correct the source order of nodes in a root.
  
  @param {Object} root PostCSS root node.
  @return {Object} sortedRoot Root with nodes sorted by source order.