Nikolay Volkov
Nikolay Volkov

Reputation: 31

CSS PostStylus Webpack 4

Using CSS autoprefixer seaneking/poststylus for webpack 4. As in manual adding plugin in config:

plugins: [
  new webpack.LoaderOptionsPlugin({
    options: {
      stylus: {
        use: [poststylus([ 'autoprefixer', 'rucksack-css' ])]
      }
    }
  })
]

And importing stylus-file from js-file, so styles should be included in js-file

import css from './app.styl';

Package goes without errors, but there are no autoprefixes in result file. What am I doing wrong?

Upvotes: 3

Views: 405

Answers (1)

R-J
R-J

Reputation: 936

Use this package instead: https://github.com/jescalan/autoprefixer-stylus

const autoprefixer = require('autoprefixer-stylus');

{
  test: /\.styl$/,
  use: [
    {
      loader: 'style-loader', // creates style nodes from JS strings
    },
    {
      loader: 'css-loader', // translates CSS into CommonJS
    },
    {
      loader: 'stylus-loader', // compiles Stylus to CSS
      options: {
        use: [
          autoprefixer(),
        ],
      },
    },
  ],
},

Upvotes: 2

Related Questions