CSS PostStylus Webpack 4 - PullRequest
       16

CSS PostStylus Webpack 4

0 голосов
/ 25 мая 2018

Использование CSS autoprefixer seaneking / poststylus для веб-пакета 4. Как и при ручном добавлении плагина в конфигурации:

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

И импорт стилус-файла из js-файла, поэтому стили должны быть включены в js-файл

import css from './app.styl';

Пакет проходит без ошибок, но в файле результатов нет авторефиксов.Что я делаю не так?

1 Ответ

0 голосов
/ 17 декабря 2018

Используйте этот пакет вместо: 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(),
        ],
      },
    },
  ],
},
...