postcss-loader: Post-css not running

I currently have

loaders: [
            {
                test:   /\.css$/,
                loader: 'style-loader!css-loader!postcss-loader'
            }
        ],
postcss: {
        defaults: [
            autoprefixer({
                browsers: ['last 2 version']
            })
        ]
    }

The CSS I am passing to the loader is

/** @define DateTime; use strict */

:root {
    --DateTime--understateTime-font-size: 0.75em;
}

.DateTime--understateTime .DateTime-time {
    font-size: var(--DateTime--understateTime-font-size); /* 1 */
}

but then what’s being passed back is the same as what is passed the loader any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 22 (12 by maintainers)

Most upvoted comments

@ai, well, have same issue too. Now it’s with postcss-mixins. Webpack config fragment:

import autoprefixer from "autoprefixer";
import mixins from "postcss-mixins";

...

  module: {
    loaders: [
      {
        test: /\.css$/,
        loader: ExtractTextPlugin.extract("css?modules=true!postcss"),
      }
    ]
  },

  postcss: [
    mixins(),
    autoprefixer({
      browsers: "last 2 versions"
    })
  ],

styles.css


@define-mixin mixThis $url {
  content: url($url);
}

.test {
  @mixin mixThis "./home.png";
}

And exactly the same I see in output. The most interesting thing here is that autoprefixer works. But mixins are not. Tried both mixins() and mixins in postcss array, no effect.