How to use the postcss.list.comma function in postcss

To help you get started, we’ve selected a few postcss examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GoogleContainerTools / kpt / node_modules / autoprefixer / lib / hacks / grid-utils.js View on Github external
}

    var gridAreaRuleIndex = gridAreaMedia ? css.index(gridAreaMedia) : css.index(gridAreaRule);
    var value = gridArea.value; // found the data that matches grid-area identifier

    var data = gridTemplatesData.filter(function (d) {
      return d.allAreas.includes(value);
    })[0];

    if (!data) {
      return true;
    }

    var lastArea = data.allAreas[data.allAreas.length - 1];
    var selectorBySpace = list.space(gridAreaRule.selector);
    var selectorByComma = list.comma(gridAreaRule.selector);
    var selectorIsComplex = selectorBySpace.length > 1 && selectorBySpace.length > selectorByComma.length; // prevent doubling of prefixes

    if (hasPrefixedRow) {
      return false;
    } // create the empty object with the key as the last area name
    // e.g if we have templates with "a b c" values, "c" will be the last area


    if (!rulesToInsert[lastArea]) {
      rulesToInsert[lastArea] = {};
    }

    var lastRuleIsSet = false; // walk through every grid-template rule data

    for (var _iterator2 = data.rules, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
      var _ref9;
github fga-eps-mds / 2018.2-Kalkuli / website / node_modules / autoprefixer / lib / hacks / grid-utils.js View on Github external
}

    // abort if we outside media rule and walking below our rule
    // (we need to check ONLY the rules that are above)
    if (!inMediaRule && isLookingDown) {
      return false;
    }

    // abort if we're in the same rule
    if (isEqual) {
      return false;
    }

    // if we're inside media rule, we need to compare selectors
    if (inMediaRule) {
      var selectors = list.comma(nodeRule.selector);
      var selectorIsFound = selectors.some(function (sel) {
        if (sel === rule.selector) {
          // compare selectors as a comma list
          return true;
        } else if (nodeRule.selector === rule.selector) {
          // compare selectors as a whole (e.g. ".i, .j" === ".i, .j")
          return true;
        }
        return false;
      });

      // stop walking if we found the selector
      if (selectorIsFound) {
        return false;
      }
    }
github lintopher0315 / Quick-Math / node_modules / autoprefixer / lib / hacks / grid-utils.js View on Github external
}

    var gridAreaRuleIndex = gridAreaMedia ? css.index(gridAreaMedia) : css.index(gridAreaRule);
    var value = gridArea.value; // found the data that matches grid-area identifier

    var data = gridTemplatesData.filter(function (d) {
      return d.allAreas.includes(value);
    })[0];

    if (!data) {
      return true;
    }

    var lastArea = data.allAreas[data.allAreas.length - 1];
    var selectorBySpace = list.space(gridAreaRule.selector);
    var selectorByComma = list.comma(gridAreaRule.selector);
    var selectorIsComplex = selectorBySpace.length > 1 && selectorBySpace.length > selectorByComma.length; // prevent doubling of prefixes

    if (hasPrefixedRow) {
      return false;
    } // create the empty object with the key as the last area name
    // e.g if we have templates with "a b c" values, "c" will be the last area


    if (!rulesToInsert[lastArea]) {
      rulesToInsert[lastArea] = {};
    } // walk through every grid-template rule data


    for (var _iterator2 = data.rules, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
      var _ref9;
github GoogleContainerTools / kpt / site / node_modules / autoprefixer / lib / hacks / grid-utils.js View on Github external
}

    var gridAreaRuleIndex = gridAreaMedia ? css.index(gridAreaMedia) : css.index(gridAreaRule);
    var value = gridArea.value; // found the data that matches grid-area identifier

    var data = gridTemplatesData.filter(function (d) {
      return d.allAreas.includes(value);
    })[0];

    if (!data) {
      return true;
    }

    var lastArea = data.allAreas[data.allAreas.length - 1];
    var selectorBySpace = list.space(gridAreaRule.selector);
    var selectorByComma = list.comma(gridAreaRule.selector);
    var selectorIsComplex = selectorBySpace.length > 1 && selectorBySpace.length > selectorByComma.length; // prevent doubling of prefixes

    if (hasPrefixedRow) {
      return false;
    } // create the empty object with the key as the last area name
    // e.g if we have templates with "a b c" values, "c" will be the last area


    if (!rulesToInsert[lastArea]) {
      rulesToInsert[lastArea] = {};
    }

    var lastRuleIsSet = false; // walk through every grid-template rule data

    for (var _iterator2 = data.rules, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
      var _ref9;
github johandb / svg-drawing-tool / node_modules / autoprefixer / lib / hacks / grid-utils.js View on Github external
}

    var gridAreaRuleIndex = gridAreaMedia ? css.index(gridAreaMedia) : css.index(gridAreaRule);
    var value = gridArea.value; // found the data that matches grid-area identifier

    var data = gridTemplatesData.filter(function (d) {
      return d.allAreas.includes(value);
    })[0];

    if (!data) {
      return true;
    }

    var lastArea = data.allAreas[data.allAreas.length - 1];
    var selectorBySpace = list.space(gridAreaRule.selector);
    var selectorByComma = list.comma(gridAreaRule.selector);
    var selectorIsComplex = selectorBySpace.length > 1 && selectorBySpace.length > selectorByComma.length; // prevent doubling of prefixes

    if (hasPrefixedRow) {
      return false;
    } // create the empty object with the key as the last area name
    // e.g if we have templates with "a b c" values, "c" will be the last area


    if (!rulesToInsert[lastArea]) {
      rulesToInsert[lastArea] = {};
    } // walk through every grid-template rule data


    for (var _iterator2 = data.rules, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
      var _ref9;
github postcss / autoprefixer / lib / utils.js View on Github external
splitSelector (selector) {
    return list
      .comma(selector)
      .map(i => {
        return list.space(i).map(k => {
          return k.split(/(?=\.|#)/g)
        })
      })
  }
github GoogleContainerTools / kpt / docsy / node_modules / autoprefixer / lib / utils.js View on Github external
editList: function editList(value, callback) {
    var origin = list.comma(value);
    var changed = callback(origin, []);

    if (origin === changed) {
      return value;
    }

    var join = value.match(/,\s*/);
    join = join ? join[0] : ', ';
    return changed.join(join);
  },
github makuga01 / dnsFookup / FE / node_modules / autoprefixer / lib / transition.js View on Github external
decl.parent.each(function (i) {
      if (i.type !== 'decl') {
        return undefined;
      }

      if (i.prop.indexOf('transition-') !== 0) {
        return undefined;
      }

      if (i.prop === 'transition-property') {
        return undefined;
      }

      if (list.comma(i.value).length > 1) {
        decl.warn(result, 'Replace transition-property to transition, ' + 'because Autoprefixer could not support ' + 'any cases of transition-property ' + 'and other transition-*');
      }

      return false;
    });
  }
github lintopher0315 / Quick-Math / node_modules / autoprefixer / lib / hacks / grid-utils.js View on Github external
ruleSelectors = ruleSelectors.map(function (selector) {
    var selectorBySpace = list.space(selector);
    var selectorByComma = list.comma(selector);

    if (selectorBySpace.length > selectorByComma.length) {
      selector = selectorBySpace.slice(-1).join('');
    }

    return selector;
  });
  return ruleSelectors.map(function (ruleSelector) {
github ben-eb / perfectionist / src / maxSelectorLength.js View on Github external
function splitProperty (rule, prop, opts) {
    const {breakEvery, reindent, reduce, max} = {
        reindent: false,
        ...opts,
    };
    const property = rule[prop];
    if (!max || !property) {
        return;
    }
    const exploded = list.comma(property);
    if (property.length > max || reduce) {
        let indent = 0;
        if (typeof reindent === 'function') {
            indent = reindent(rule);
        }
        rule[prop] = exploded.reduce((lines, chunk) => {
            if (breakEvery) {
                lines.push(chunk);
                return lines;
            }
            if (lines[lines.length - 1].length + indent <= max) {
                const merged = `${lines[lines.length - 1]}, ${chunk}`;
                if (indent + merged.length <= max) {
                    lines[lines.length - 1] = merged;
                    return lines;
                }