var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');

module.exports = {
  entry: ["./main.js", "./scss/main.scss"], //, "./scss/main.scss"
  output: {
    path: __dirname + "/static",
    filename: "main.js"
  },
  devtool: 'source-map',
  module: {
    rules: [
      /* your other rules for JavaScript transpiling go in here */
      {
        // regular css files
        test: /\.css$/,
        use: ExtractTextPlugin.extract({ loader: 'css-loader?importLoaders=1', }),
      },
      {
        // sass / scss loader for webpack
        test: /\.(sass|scss)$/,
        use: ExtractTextPlugin.extract(['css-loader', 'sass-loader'])
      },
      {
        // fonts
        test: /\.(eot|svg|ttf|woff|woff2)$/,
        use: "file-loader?name=fonts/[name].[ext]"
      },
    ]
  },
  plugins: [
    new ExtractTextPlugin({
      // define where to save the file
      filename: '[name].css', allChunks: true,
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false
      }
    })
  ]
};
