index.js
function processIfValues(css, result, rule, decl, queries) {
  var query = null;
  var re = /(.*)\s+(?:\?if|\?)\s+media\s+(.*)/;
  var re2 = /\s/g;
  var hash = null;

  // Check if we're working with comments.
  var match = decl.value ? decl.value.match(re) : decl.text.match(re);
  // console.log(match)
  if(match && match[1] && match[2]) {
    if(decl.value)
      decl.value = match[1];
    else
      decl.text = match[1];
    hash = match[2].replace(re2, '');

    if(!queries[hash]) {
      queries[hash] = {
        arg: match[2],
        sel: rule.selector,
        props: []
      }
    }
    queries[hash].props.push({name: decl.prop, value: match[1], query: match[2], hash: hash, decl: decl});
  }
  else
    decl.warn(result, 'Appears to be a malformed `?if media` query -> ' + decl);
}
function processIfValues(css, result, rule, decl, queries) {
  var query = null;
  var re = /(.*)\s+(?:\?if|\?)\s+media\s+(.*)/;
  var re2 = /\s/g;
  var hash = null;

  // Check if we're working with comments.
  var match = decl.value ? decl.value.match(re) : decl.text.match(re);
  // console.log(match)
  if(match && match[1] && match[2]) {
    if(decl.value)
      decl.value = match[1];
    else
      decl.text = match[1];
    hash = match[2].replace(re2, '');

    if(!queries[hash]) {
      queries[hash] = {
        arg: match[2],
        sel: rule.selector,
        props: []
      }
    }
    queries[hash].props.push({name: decl.prop, value: match[1], query: match[2], hash: hash, decl: decl});
  }
  else
    decl.warn(result, 'Appears to be a malformed `?if media` query -> ' + decl);
}
function processIfValues ( css , result , rule , decl , queries ) { var query = null ; var re = / (.*)\s+(?:\?if|\?)\s+media\s+(.*) / ; var re2 = / \s / g ; var hash = null ; // Check if we're working with comments. var match = decl . value ? decl . value . match ( re ) : decl . text . match ( re ) ; // console.log(match) if ( match && match [ 1 ] && match [ 2 ] ) { if ( decl . value ) decl . value = match [ 1 ] ; else decl . text = match [ 1 ] ; hash = match [ 2 ] . replace ( re2 , '' ) ; if ( ! queries [ hash ] ) { queries [ hash ] = { arg : match [ 2 ] , sel : rule . selector , props : [ ] } } queries [ hash ] . props . push ( { name : decl . prop , value : match [ 1 ] , query : match [ 2 ] , hash : hash , decl : decl } ) ; } else decl . warn ( result , 'Appears to be a malformed `?if media` query -> ' + decl ) ; }
Extract the values and add them to the list of queries. Props are grouped by their queries, so that they appear in the same @media block later.
Extract the values and add them to the list of queries . Props are grouped by their queries so that they appear in the same