How to use the postcss-media-query-parser function in postcss-media-query-parser

To help you get started, we’ve selected a few postcss-media-query-parser 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 kristerkari / stylelint-scss / src / rules / operator-no-unspaced / index.js View on Github external
}

    // Selector
    if (item.selector !== undefined) {
      results = results.concat(findInterpolation(item.selector));
    }

    if (item.type === "atrule") {
      // @forward and @use
      if (item.name === "forward" || item.name === "use") {
        return;
      }

      // Media queries
      if (item.name === "media" || item.name === "import") {
        mediaQueryParser(item.params).walk(node => {
          const type = node.type;

          if (["keyword", "media-type", "media-feature"].includes(type)) {
            results = results.concat(
              findInterpolation(
                node.value,
                atRuleParamIndex(item) + node.sourceIndex
              )
            );
          } else if (["value", "url"].includes(type)) {
            results.push({
              source: node.value,
              operators: findOperators({
                string: node.value,
                globalIndex: atRuleParamIndex(item) + node.sourceIndex,
                isAfterColon: true
github stylelint / stylelint / src / rules / media-feature-name-case / index.js View on Github external
root.walkAtRules(/^media$/i, atRule => {
      mediaParser(atRule.params).walk(/^media-feature$/i, mediaFeatureNode => {
        const { parent, sourceIndex, value } = mediaFeatureNode

        if (isRangeContextMediaFeature(parent.value)
          || !isStandardSyntaxMediaFeatureName(value)
          || isCustomMediaQuery(value)
        ) { return }

        const expectedFeatureName = expectation === "lower"
          ? value.toLowerCase()
          : value.toUpperCase()

        if (value === expectedFeatureName) { return }

        report({
          index: atRuleParamIndex(atRule) + sourceIndex,
          message: messages.expected(value, expectedFeatureName),
github stylelint / stylelint / src / rules / media-feature-name-no-unknown / index.js View on Github external
root.walkAtRules(/^media$/i, atRule => {
      mediaParser(atRule.params).walk(/^media-feature$/i, mediaFeatureNode => {
        const { parent, sourceIndex, value } = mediaFeatureNode

        if (isRangeContextMediaFeature(parent.value)
          || !isStandardSyntaxMediaFeatureName(value)
          || isCustomMediaQuery(value)
        ) { return }

        if (optionsMatches(options, "ignoreMediaFeatureNames", value)) { return }

        if (vendor.prefix(value) || mediaFeatureNames.has(value.toLowerCase())) { return }

        report({
          index: atRuleParamIndex(atRule) + sourceIndex,
          message: messages.rejected(value),
          node: atRule,
          ruleName,

postcss-media-query-parser

A tool for parsing media query lists.

MIT
Latest version published 8 years ago

Package Health Score

65 / 100
Full package analysis

Popular postcss-media-query-parser functions