<commit_before>import {WebpackConfig, get} from '@easy-webpack/core'
const ExtractTextPlugin = require('extract-text-webpack-plugin')

/**
 * CSS loader support for *.css
 * @param sourceMap enable generating source maps (slower build)
 * @param extractCss leave empty to skip extracting CSS or define an object with filename and optionally allChunks (boolean)
 */
export = function css(sourceMap = false, extractCss = { filename: '[name].css', allChunks: false }) {
  return function css(this: WebpackConfig): WebpackConfig {
    const extractCSSinstance = extractCss ? new ExtractTextPlugin(extractCss.filename || '[name].css', extractCss) : null
    const cssLoader = `css${sourceMap ? '?sourceMap' : ''}`
    const config = {
      module: {
        loaders: get(this, 'module.loaders', []).concat([{
          test: /\.css$/i,
          loaders: extractCss ? extractCSSinstance.extract('style', cssLoader) : ['style', cssLoader]
        }])
      }
    } as WebpackConfig
    if (extractCSSinstance) {
      config.plugins = [
        /**
         * Plugin: ExtractTextPlugin
         * It moves every import "style.css" in entry chunks into a single concatenated css output file. 
         * So your styles are no longer inlined into the javascript, but separate in a css bundle file (styles.css). 
         * If your total stylesheet volume is big, it will be faster because the stylesheet bundle is loaded in parallel to the javascript bundle.
         */
        extractCSSinstance
      ].concat(get(this, 'plugins', []))
    }
    return config
  }
}<commit_msg>feat(index): migrate to object based parameters<commit_after>import {WebpackConfig, get} from '@easy-webpack/core'
const ExtractTextPlugin = require('extract-text-webpack-plugin')

/**
 * CSS loader support for *.css
 * @param sourceMap enable generating source maps (slower build)
 * @param extractCss leave empty to skip extracting CSS or define an object with filename and optionally allChunks (boolean)
 */
export = function css(extractCss = { filename: '[name].css', allChunks: false, sourceMap: false }) {
  return function css(this: WebpackConfig): WebpackConfig {
    const extractCSSinstance = extractCss ? new ExtractTextPlugin(extractCss.filename || '[name].css', extractCss) : null
    const cssLoader = `css${extractCss.sourceMap ? '?sourceMap' : ''}`
    const config = {
      module: {
        loaders: get(this, 'module.loaders', []).concat([{
          test: /\.css$/i,
          loaders: extractCss ? extractCSSinstance.extract('style', cssLoader) : ['style', cssLoader]
        }])
      }
    } as WebpackConfig
    if (extractCSSinstance) {
      config.plugins = [
        /**
         * Plugin: ExtractTextPlugin
         * It moves every import "style.css" in entry chunks into a single concatenated css output file. 
         * So your styles are no longer inlined into the javascript, but separate in a css bundle file (styles.css). 
         * If your total stylesheet volume is big, it will be faster because the stylesheet bundle is loaded in parallel to the javascript bundle.
         */
        extractCSSinstance
      ].concat(get(this, 'plugins', []))
    }
    return config
  }
}
{'fraction_non_alphanumeric': 0.10783699059561129, 'fraction_numerical': 0.0, 'mean_word_length': 3.2097625329815305, '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': '50932', 'n_tokens_mistral': 884, 'n_tokens_neox': 849, 'n_words': 301}