DavidWells / PostCSS-tutorial

Tutorial on adding PostCSS to `create-react-app` CLI
102 stars 14 forks source link

Hook up CSS modules (Edit or leave a quote) #31

Open bohdanafanasyev opened 7 years ago

bohdanafanasyev commented 7 years ago

I've recently came across this approach and found it very useful. Seems like Create-React-App made a few changes to their project. I am pretty newbie to figure out what and why they did, but to make imports work the 1st part of tutorial where is says:

// change: webpack.config.dev.js
{
   test: /\.css$/,
   include: srcPath,
   loader: 'style!css!postcss'
},
// to:
{
  test: /\.css$/,
  include: srcPath,
  loader: 'style!css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]&camelCase!postcss'
},

Should be skipped, then you continue with package installs and poss.css.configs and everything works fine.