require('babel-polyfill');

// Webpack config for development
var fs = require('fs');
var path = require('path');
var webpack = require('webpack');
var WebpackIsomorphicTools = require('webpack-isomorphic-tools');
var assetsPath = path.resolve(__dirname, '../static/dist');
var host = (process.env.HOST || 'localhost');
var port = parseInt(process.env.PORT) + 1 || 3001;
var ExtractTextPlugin = require('extract-text-webpack-plugin')

// https://github.com/halt-hammerzeit/webpack-isomorphic-tools
var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin');
var webpackIsomorphicToolsPlugin = new WebpackIsomorphicToolsPlugin(require('./webpack-isomorphic-tools'));

module.exports = {
  devtool: 'inline-source-map',
  context: path.resolve(__dirname, '..'),
  entry: {
    'main': [
      'webpack-hot-middleware/client?path=http://' + host + ':' + port + '/__webpack_hmr',
      './src/index.js'
    ]
  },
  output: {
    path: assetsPath,
    filename: '[name]-[hash].js',
    chunkFilename: '[name]-[chunkhash].js',
    publicPath: 'http://' + host + ':' + port + '/dist/'
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel',
        query: {
          cacheDirectory: true,
          plugins:
            [ // for development
              'transform-runtime',
              ["react-transform", {
                "transforms": [{
                  "transform": "react-transform-hmr",
                  "imports": ["react"],
                  "locals": ["module"]
                }]
              }]
            ]
        }
      },
      { test: /\.json$/, loader: 'json-loader' },
      { test: /\.less$/, loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!less?outputStyle=expanded&sourceMap' },
      { test: /\.scss$/, loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap' },
      { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
      { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
      { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" },
      { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" },
      { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" },
      { test: webpackIsomorphicToolsPlugin.regular_expression('images'), loader: 'url-loader?limit=10240' },
      {
        test: /\.css$/,
        loader: ExtractTextPlugin.extract('style-loader', "css-loader")
      }
    ]
  },
  progress: true,
  resolve: {
    modulesDirectories: [
      'src',
      'node_modules'
    ],
    extensions: ['', '.json', '.js', '.jsx'],
    alias: {
      ScrollMagic: 'scrollmagic/scrollmagic/uncompressed/ScrollMagic.js'
    }
  },
  plugins: [
    // hot reload
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.IgnorePlugin(/webpack-stats\.json$/),
    new webpack.DefinePlugin({
      'process.env': {
        BROWSER: true
      },
      __CLIENT__: true,
      __SERVER__: false,
      __DEVELOPMENT__: true,
      __DEVTOOLS__: true  // <-------- DISABLE redux-devtools HERE
    }),
    new ExtractTextPlugin('[name].css'),
    webpackIsomorphicToolsPlugin.development()
  ]
};

@@ -55,16 +55,62 @@
 lopment%0A
+const autoprefixer = require('autoprefixer');%0A
 var fs =
@@ -1716,32 +1716,40 @@
 ader' %7D,%0A      %7B
+%0A       
  test: /%5C.less$/
@@ -1746,31 +1746,64 @@
  /%5C.
-le
+c
 ss$/,
+%0A       
  loader
+s
 : 
-'style!
+%5B%0A          'style',%0A          '
 css?
@@ -1820,35 +1820,25 @@
 portLoaders=
-2&sourceMap
+1
 &localIdentN
@@ -1838,32 +1838,40 @@
 lIdentName=%5B
+name%5D__%5B
 local%5D__
 _%5Bhash:base6
@@ -1850,33 +1850,32 @@
 name%5D__%5Blocal%5D__
-_
 %5Bhash:base64:5%5D!
@@ -1877,82 +1877,48 @@
 4:5%5D
-!autoprefixer?browsers=last 2 version!less?outputStyle=expanded&sourceMap'
+',%0A          'postcss',%0A        %5D,%0A     
  %7D,%0A
@@ -1926,24 +1926,32 @@
      %7B test:
+%0A       
  /%5C.scss$/, 
@@ -1953,24 +1953,58 @@
 s$/,
+%0A       
  loader
+s
 : 
-'style!
+%5B%0A          'style',%0A          '
 css?
@@ -2031,18 +2031,8 @@
 s=2&
-sourceMap&
 loca
@@ -2043,24 +2043,32 @@
 ntName=%5B
+name%5D__%5B
 local%5D__
 _%5Bhash:b
@@ -2059,17 +2059,16 @@
 local%5D__
-_
 %5Bhash:ba
@@ -2078,82 +2078,64 @@
 4:5%5D
-!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap'
+',%0A          'postcss',%0A          'sass'%0A        %5D%0A     
  %7D,%0A
@@ -2727,125 +2727,40 @@
     
-  %7B%0A        test: /%5C.css$/,%0A        loader: ExtractTextPlugin.extract('style-loader', %22css-loader%22)%0A      %7D%0A    %5D%0A  %7D
+%5D%0A  %7D,%0A  postcss: %5Bautoprefixer%5D
 ,%0A  

integrate bootstrap