lib/atRule.js
function getCriticalFromAtRule(args) {
  var result = {};
  var options = _extends({
    defaultDest: 'critical.css',
    css: _postcss2.default.root()
  }, args);

  options.css.walkAtRules('critical', function (atRule) {
    var name = atRule.params ? atRule.params : options.defaultDest;
    // If rule has no nodes, all the nodes of the parent will be critical.
    var rule = atRule;
    if (!atRule.nodes) {
      rule = atRule.root();
    }
    rule.clone().each(function (node) {
      if (node.name !== 'critical') {
        result[name] = result[name] ? result[name].append(node) : _postcss2.default.root().append(node);
      }
    });
  });
  return result;
}
function getCriticalFromAtRule(args) {
  var result = {};
  var options = _extends({
    defaultDest: 'critical.css',
    css: _postcss2.default.root()
  }, args);

  options.css.walkAtRules('critical', function (atRule) {
    var name = atRule.params ? atRule.params : options.defaultDest;
    // If rule has no nodes, all the nodes of the parent will be critical.
    var rule = atRule;
    if (!atRule.nodes) {
      rule = atRule.root();
    }
    rule.clone().each(function (node) {
      if (node.name !== 'critical') {
        result[name] = result[name] ? result[name].append(node) : _postcss2.default.root().append(node);
      }
    });
  });
  return result;
}
function getCriticalFromAtRule ( args ) { var result = { } ; var options = _extends ( { defaultDest : 'critical.css' , css : _postcss2 . default . root ( ) } , args ) ; options . css . walkAtRules ( 'critical' , function ( atRule ) { var name = atRule . params ? atRule . params : options . defaultDest ; // If rule has no nodes, all the nodes of the parent will be critical. var rule = atRule ; if ( ! atRule . nodes ) { rule = atRule . root ( ) ; } rule . clone ( ) . each ( function ( node ) { if ( node . name !== 'critical' ) { result [ name ] = result [ name ] ? result [ name ] . append ( node ) : _postcss2 . default . root ( ) . append ( node ) ; } } ) ; } ) ; return result ; }
Get critical CSS from an at-rule.

@param {Object} args Function args. See flow type alias.
Get critical CSS from an at - rule .