index.js
function createAtRules(css, rule, queries) {
  var parent = rule.parent;
  var prev = rule;

  for(var k in queries) {
    var q = queries[k];
    var at = postcss.atRule({name: 'media', params: q.arg, source: rule.source});
    var qr = postcss.rule ({selector: q.sel, source: rule.source});

    at.append(qr);

    for (var i = 0; i < q.props.length; i++) {
      var prop = q.props[i];
      qr.append(prop.decl.remove());
    };

    // Again we keep track of the previous insert and insert after it, to maintain the original order
    // and CSS specificity.
    parent.insertAfter(prev, at);
    prev = at;
  }

}
function createAtRules(css, rule, queries) {
  var parent = rule.parent;
  var prev = rule;

  for(var k in queries) {
    var q = queries[k];
    var at = postcss.atRule({name: 'media', params: q.arg, source: rule.source});
    var qr = postcss.rule ({selector: q.sel, source: rule.source});

    at.append(qr);

    for (var i = 0; i < q.props.length; i++) {
      var prop = q.props[i];
      qr.append(prop.decl.remove());
    };

    // Again we keep track of the previous insert and insert after it, to maintain the original order
    // and CSS specificity.
    parent.insertAfter(prev, at);
    prev = at;
  }

}
function createAtRules ( css , rule , queries ) { var parent = rule . parent ; var prev = rule ; for ( var k in queries ) { var q = queries [ k ] ; var at = postcss . atRule ( { name : 'media' , params : q . arg , source : rule . source } ) ; var qr = postcss . rule ( { selector : q . sel , source : rule . source } ) ; at . append ( qr ) ; for ( var i = 0 ; i < q . props . length ; i ++ ) { var prop = q . props [ i ] ; qr . append ( prop . decl . remove ( ) ) ; } ; // Again we keep track of the previous insert and insert after it, to maintain the original order // and CSS specificity. parent . insertAfter ( prev , at ) ; prev = at ; } }
The previously extracted inline queries and their associated properties are used to create @media rules below(to maintain CSS specificity) the parent rule.
The previously extracted inline queries and their associated properties are used to create