src/index.js
function sortGroups(selector) {
  selector.each((subSelector) => {
    subSelector.nodes.sort((a, b) => {
      // different types cannot be sorted
      if (a.type !== b.type) {
        return 0;
      }

      // sort alphabetically
      return a.value < b.value ? -1 : 1;
    });
  });

  selector.sort((a, b) => (a.nodes.join('') < b.nodes.join('') ? -1 : 1));
}
function sortGroups(selector) {
  selector.each((subSelector) => {
    subSelector.nodes.sort((a, b) => {
      // different types cannot be sorted
      if (a.type !== b.type) {
        return 0;
      }

      // sort alphabetically
      return a.value < b.value ? -1 : 1;
    });
  });

  selector.sort((a, b) => (a.nodes.join('') < b.nodes.join('') ? -1 : 1));
}
function sortGroups ( selector ) { selector . each ( ( subSelector ) => { subSelector . nodes . sort ( ( a , b ) => { // different types cannot be sorted if ( a . type !== b . type ) { return 0 ; } // sort alphabetically return a . value < b . value ? - 1 : 1 ; } ) ; } ) ; selector . sort ( ( a , b ) => ( a . nodes . join ( '' ) < b . nodes . join ( '' ) ? - 1 : 1 ) ) ; }
Sort class and id groups alphabetically
@param {Object} selector - postcss selector node
Sort class and id groups alphabetically