Answer the question
In order to leave comments, you need to log in
How to include PostCSS in Create-React-App 2?
Tell me please. I want to add a PostCSS nesting plugin to create-react-app 2 ( https://www.npmjs.com/package/postcss-nesting). I made an eject and added it to the webpack configuration. But inheritance doesn't work. Who dealt with PostCSS in CRA2, tell me what I did wrong? Or maybe there is a way to connect modules without eject?
The second day I google, but to no avail.
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebook/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
autoprefixer: {
flexbox: 'no-2009',
},
stage: 3,
}),
require('postcss-nesting'), // <------ Вот сюда добавил модуль
],
Answer the question
In order to leave comments, you need to log in
require('postcss-nesting')() - call the factory function that is returned from the module
// EDIT
What are you doing fooling us! :)
Read the specification first , and then invent non-existent CSS rules.
.SomeClass {
&-foo { // < Такого в спецификации нет!
}
}
.App {
text-align: center;
&.gg { // < работает
color: #1e90ff;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question