code: function sortScope(scope) {
      var rules = [];
      scope.each(function (node) {
  
          /* skip progress in @keyframes */
          if (node.type === 'rule' && node.selector.match(/^(?:from|to)$|%$/)) {
              return;
          }
  
          /* calculate range for rules and scopes */
          if (node.type === 'rule' || isScope(node)) {
              rules.push(_extends(getRange(node), { node: node }));
          }
  
          /* sort inside scopes */
          if (isScope(node)) {
              sortScope(node);
          }
      });
  
      var sorted = rules.sort(compareRange);
      sorted.forEach(function (rule, i) {
          if (i > 0) {
              rule.node.moveAfter(sorted[i - 1].node);
          }
      });
  }
docs: Sort style rules inside a scope node (root / @media / @supports)