These are chat archives for newtriks/generator-react-webpack

12th
May 2016
Joel Kinman
@jkinman
May 12 2016 16:43
hello, awesome generator! thanks.
im adding postCSS and running into an issue.
what block / property do I need to add the postCSS loader call into in the cfg/base file?
Joel Kinman
@jkinman
May 12 2016 17:30
@sthzg does this look correct?
'use strict';
let path = require('path');
let defaultSettings = require('./defaults');
let additionalPaths = [];
module.exports = {
  additionalPaths: additionalPaths,
  port: defaultSettings.port,
  debug: true,
  devtool: 'eval-source-map',
  output: {
    path: path.join(__dirname, '/../dist/assets'),
    filename: 'app.js',
    publicPath: `.${ defaultSettings.publicPath }`
  },
  devServer: {
    contentBase: './src/',
    historyApiFallback: true,
    hot: true,
    port: defaultSettings.port,
    publicPath: defaultSettings.publicPath,
    noInfo: false
  },
  resolve: {
    extensions: [
      '',
      '.js',
      '.jsx'
    ],
    alias: {
      actions: `${ defaultSettings.srcPath }/actions/`,
      components: `${ defaultSettings.srcPath }/components/`,
      sources: `${ defaultSettings.srcPath }/sources/`,
      stores: `${ defaultSettings.srcPath }/stores/`,
      styles: `${ defaultSettings.srcPath }/styles/`,
      config: `${ defaultSettings.srcPath }/config/` + process.env.REACT_WEBPACK_ENV
    }
  },
  module: {},
  postcss: function () {
    return [
      require('postcss-font-magician')({hosted: `${ defaultSettings.srcPath }/images/fonts`}),
      require('autoprefixer')({browsers: ['last 2 versions', 'ie >= 8']}),
      require('postcss-canadian-stylesheets'),
      require('colorguard'),
    ]
  }

};
Stephan Herzog
@sthzg
May 12 2016 17:35
@jkinman I personally haven't set up postcss so far, so I am afraid I am not sure. :) but according to the READMEit looks fine to me at the root level of the config object.
But probably someone more qualified will come along and confirm or rectify that.
Joel Kinman
@jkinman
May 12 2016 18:12
lol, thanks for checking
I also added the loader in cfg/defaults.js
    loaders: [
      {
        test: /\.css$/,
        loader: 'style-loader!css-loader!postcss-loader'
      },
Joel Kinman
@jkinman
May 12 2016 22:20
@weblogixx ^^ :) ?