Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 679
Nikolay Volkov Avatar asked Jan 19 '26 15:01

Nikolay Volkov


1 Answers

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(),
        ],
      },
    },
  ],
},
like image 50
R-J Avatar answered Jan 21 '26 07:01

R-J



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!