postcss/postcss-mixins

postcss-hexrgba or postcss-color-mod-function doesn't work inside mixins

NickyLarin opened this issue · 1 comments

Noticed that plugins like postcss-hexrgba or postcss-color-mod-function doesn't work properly inside mixins starting with 7 version, but works fine in v6.2.3.

Description

I used postcss-cli to reproduce this issue

package.json

{
  "dependencies": {
    "postcss-hexrgba": "^2.0.1",
    "postcss-mixins": "^7.0.3"
  }
}

postcss.config.json

module.exports = {
  plugins: [require('postcss-mixins'), require('postcss-hexrgba')],
}

input.css

@define-mixin test-mixin $color {
  color: rgba($color, 0.5);
}

.test {
  @mixin test-mixin #fff;
  background: rgba(#000, 0.7);
}

Expected output: (got from v6.2.3)

.test {
  color: rgba(255,255,255, 0.5);
  background: rgba(0,0,0, 0.7);
}

Actual output:

.test {
  color: rgba(#fff, 0.5);
  background: rgba(0,0,0, 0.7);
}

postcss-mixins v6.2.3 works as expected

Same problem with color-mod() from postcss-color-mod-function plugin.

ai commented

Plugins need to be updated to PostCSS 8 event API for cross-plugins support. So you need to open issues in these plugins.