<commit_before>var HtmlWebpackPlugin = require('html-webpack-plugin');

var loaders = [
  {
    test: /(\.html)?\.(slm|slim)/,
    loaders: ["html?interpolate", "slm"]
  },
  {
    test: /\.coffee$/,
    loader: "coffee-loader"
  },
  {
    test: /\.(coffee\.md|litcoffee)$/,
    loader: "coffee-loader?literate"
  },
  {
    test: /\.md$/,
    loaders: ["html?interpolate", "markdown"]
  },
  {
    test: /\.(jpe?g|png|gif|svg)$/i,
    loaders: [
      'file?hash=sha512&digest=hex&name=[hash].[ext]',
      'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
    ]
  },
  {
    test: /\.s(a|c)ss$/,
    loaders: ["style", "css", "resolve-url", "sass"]
  },
  {
    test: /\.css$/,
    loaders: ["style", "css", "resolve-url"]
  },
  {
    test: /\.json$/,
    loaders: ["json"]
  },
  {
    test: /\.yaml$/,
    loaders: ["json", "yaml"]
  }
];

module.exports = [
  {
    entry: './src/javascripts/app.coffee',
    plugins: [
      new HtmlWebpackPlugin({
        title: 'Whose News',
        filename: 'index.html',
        template: './src/views/index.slim',
        inject: 'head',
        hash: true,
        cache: true,
        showErrors: true
      })
    ],
    module: {
      loaders: loaders
    },
    output: {
      path: './build',
      filename: 'app.js',
      sourceMapFilename: 'app.js.map'
    },
    target: 'web',
    node: {
      fs: 'empty'
    }
  }<commit_msg>webpack config for multiple extensions (chrome & bookmarklet for time being)<commit_after>var HtmlWebpackPlugin = require('html-webpack-plugin');

var fileLoader = function(extension, name){
  if(!name) name = '[name]'
  extension = extension ? '.' + extension : ''
  return 'file?hash=sha512&digest=hex&name=' + name + '-[hash].[ext]' + extension
}

var slimToStringLoader  = {
                            test: /(\.html)?\.(slm|slim)/,
                            loaders: ["html?interpolate", "slm"]
                          },
    slimRawLoader       = {
                            test: /(\.html)?\.(slm|slim)/,
                            loaders: [fileLoader('html'), "extricate", "interpolate", "slm"]
                          },
    loaders = [
  {
    test: /\.coffee$/,
    loader: "coffee-loader"
  },
  {
    test: /\.(coffee\.md|litcoffee)$/,
    loader: "coffee-loader?literate"
  },
  {
    test: /\.md$/,
    loaders: ["html?interpolate", "markdown"]
  },
  {
    test: /\.(jpe?g|png|gif|svg)$/i,
    loaders: [
      fileLoader(),
      'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
    ]
  },
  {
    test: /\.s(a|c)ss$/,
    loaders: ["style", "css", "resolve-url", "sass"]
  },
  {
    test: /\.css$/,
    loaders: ["style", "css", "resolve-url"]
  },
  {
    test: /\.json$/,
    loaders: ["json"]
  },
  {
    test: /\.yaml$/,
    loaders: ["json", "yaml"]
  },
  { test: /\.cson$/, loaders: ["file?name=[name].json", "extricate", "interpolate", "cson?file"] }
];

var resolve = {
    extensions: ["", ".webpack.js", ".web.js", ".js", '.cson', '.coffee', '.slim']
};

module.exports = [
  {
    plugins: [
      new HtmlWebpackPlugin({
        title: 'Whose News',
        filename: 'index.html',
        template: './src/views/index.slim',
        inject: 'head',
        hash: true,
        cache: true,
        showErrors: true
      })
    ],
    entry: './src/chrome/manifest',
    resolve: resolve,
    module: {
      loaders: loaders.concat(slimRawLoader)
    },
    target: 'web',
    node: {
      fs: 'empty'
    },
    output: {
      path: './build/chrome',
      filename: 'manifest.js'
    },
  },
  {
    entry: './src/bookmarklet/bookmarklet',
    resolve: resolve,
    module: {
      loaders: loaders.concat(slimToStringLoader)
    },
    output: {
      path: './build/bookmarklet',
      filename: 'whosenews.js',
      sourceMapFilename: 'whosenews.js.map'
    },
    target: 'web'
  }
{'fraction_non_alphanumeric': 0.2022792022792023, 'fraction_numerical': 0.002072002072002072, 'mean_word_length': 2.038552321007081, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2595011', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1395, 'n_words': 237}