O
O
Olga2018-11-01 23:31:35
React
Olga, 2018-11-01 23:31:35

How to include global styles in a project where css-modules is used?

For the project I use the React-Quill package https://github.com/zenoamaro/react-quill, it is indicated that you can import styles `import 'react-quill/dist/quill.snow.css'. `
Such an import into the project component does not include styles, since the project uses css-modules. How to import styles in this case?
webpack config

{
  test: /\.css$/,
  use: [
  {
    loader: 'style-loader'
  },
  {
    loader: 'css-loader',
    options: {
        module: true,
        importLoaders: 1,
        localIdentName: '[path][name]__[local]'
    }
  },
  {
    loader: 'postcss-loader'
  }
]
},

@import '../../../../../../node_modules/react-quill/dist/quill.snow.css';
:global{
       @import '../../../../../../node_modules/react-quill/dist/quill.snow.css';
}

didn't work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Budnyakov, 2018-11-08
@69Roman69

include the module in webpack and paste it as in the description of the npm package into the component
import 'react-quill/dist/quill.snow.css';
module.exports = {
module: {
rules: [
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
}
]
}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question