H
H
hellcaster2019-11-07 22:47:27
JavaScript
hellcaster, 2019-11-07 22:47:27

Why don't postcss-loader and bootstrap work together?

Hey! I know this is a very stupid question, but I still don't understand why.
Decided to connect Bootstrap via npm

import 'bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';

But when I go to the site, I get this:
5dc43c0f5e2b7656610985.png
Snippet from webpack

{ // css
      test: /\.css$/,
      use: [
        MiniCssExtractPlugin.loader,
        { // css-loader
          loader: `css-loader`,
          options: {
            sourceMap: true,
            url: false
          }
        },
        {
          loader: `postcss-loader`,
          options: {
            ident: `postcss`,
            sourceMap: true,
            plugins: () => [
              require(`autoprefixer`),
              require(`css-mqpacker`),
              require(`cssnano`)({
                preset: [
                  `default`, {
                    discardComments: {
                      removeAll: true,
                    }
                  }
                ]
              })
            ]
          }
        },
        `csscomb-loader`
      ]
    }


Maybe someone knows what the problem is and how to solve it? If you need more files, please ask.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
i_m_newbie, 2019-11-08
@i_m_newbie

I usually connect the autoprefixer like this:

npm install postcss-loader --save-dev
npm i -D autoprefixer

In webpack.config.js:
{
        test: /\.scss$/,
        use:  [  'style-loader', 'css-loader', 'postcss-loader', 'sass-loader']
 }

Then in postcss.config.js:
module.exports = {
    plugins: [
      require('autoprefixer')
    ]
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question