rominmx / postcss-compact-mq

PostCSS plugin providing intuitive syntax for media queries
MIT License
10 stars 0 forks source link

Working with PostCSS8 ? #2

Open CallumJHays opened 3 years ago

CallumJHays commented 3 years ago

Just gave this a quick try, with the code:

@media w < 640 {
  .xs-flex-col {
    flex-direction: column;
  }
}

This error is produced:

Error: /home/cal/code/callumjhays.github.io/pages/index.tsx: postcss failed with Unknown error from PostCSS plugin. Your current PostCSS version is 8.1.10, but postcss-compact-mq uses 5.2.18. Perhaps this is the source of the error below.
TypeError: Cannot read property '0' of null
    at Array.map (<anonymous>)
    at Array.map (<anonymous>)
    at /home/cal/code/styled-jsx-plugin-postcss/node_modules/postcss/lib/container.js:74:18 {
  postcssNode: AtRule {
    raws: {
      before: '\n\n        ',
      between: ' ',
      afterName: ' ',
      semicolon: false,
      after: '\n        '
    },
    type: 'atrule',
    name: 'media',
    parent: Root {
      raws: [Object],
      type: 'root',
      nodes: [Array],
      source: [Object],
      lastEach: 3,
      indexes: [Object],
      [Symbol(isClean)]: false
    },
    source: { start: [Object], input: [Input], end: [Object] },
    params: 'w < 640',
    nodes: [ [Rule] ],
    lastEach: 2,
    indexes: {},
    [Symbol(isClean)]: false
  }
}
rominmx commented 3 years ago

Callum, thank you for the feedback! The problem seems to be related with the changed API of the latest PostCSS version, will fix it as far as I can (probably, during this weekend).