<commit_before>const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const postcssPresetEnv = require('postcss-preset-env');

module.exports = ({ isProduction }) => {
    const postcssPlugins = isProduction
        ? [
              postcssPresetEnv({
                  autoprefixer: {
                      flexbox: 'no-2009'
                  },
                  stage: 3
              })
          ]
        : [];

    return [
        {
            test: /\.css$/,
            use: [
                MiniCssExtractPlugin.loader,
                {
                    loader: 'css-loader',
                    options: {
                        importLoaders: 1
                    }
                }
            ]
        },
        {
            test: /\.scss$/,
            use: [
                'css-hot-loader',
                MiniCssExtractPlugin.loader,
                'css-loader',
                {
                    loader: 'postcss-loader',
                    options: {
                        ident: 'postcss',
                        plugins: postcssPlugins,
                        sourceMap: isProduction
                    }
                },
                'fast-sass-loader'
            ]
        }
    ];
};<commit_msg>Load design-system themes raw (#14)<commit_after>const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const postcssPresetEnv = require('postcss-preset-env');

const DESIGN_SYSTEM_THEME = /.*theme\.scss$/;

// Set up the variables to the design system so that files are resolved properly.
const PREPEND_SASS = `
$path-images: "~design-system/assets/img/shared/";
`;

const getSassLoaders = (isProduction) => {
    const postcssPlugins = isProduction
        ? [
              postcssPresetEnv({
                  autoprefixer: {
                      flexbox: 'no-2009'
                  },
                  stage: 3
              })
          ]
        : [];

    return [
        'css-loader',
        {
            loader: 'postcss-loader',
            options: {
                ident: 'postcss',
                plugins: postcssPlugins,
                sourceMap: isProduction
            }
        },
        {
            loader: 'fast-sass-loader',
            options: {
                data: PREPEND_SASS
            }
        }
    ];
};

module.exports = ({ isProduction }) => {
    const sassLoaders = getSassLoaders(isProduction);
    return [
        {
            test: /\.css$/,
            use: [
                MiniCssExtractPlugin.loader,
                {
                    loader: 'css-loader',
                    options: {
                        importLoaders: 1
                    }
                }
            ]
        },
        {
            test: /\.scss$/,
            exclude: DESIGN_SYSTEM_THEME,
            use: ['css-hot-loader', MiniCssExtractPlugin.loader, ...sassLoaders]
        },
        {
            test: DESIGN_SYSTEM_THEME,
            // Prevent loading the theme in <style>, we want to load it as a raw string
            use: [...sassLoaders]
        }
    ];
};
{'fraction_non_alphanumeric': 0.10594315245478036, 'fraction_numerical': 0.004521963824289405, 'mean_word_length': 1.0215404699738904, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, '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': '4873882', 'n_tokens_mistral': 858, 'n_tokens_neox': 798, 'n_words': 144}