SciPost Code Repository

Skip to content
Snippets Groups Projects
webpack.config.js 1.2 KiB
Newer Older
Jorran de Wit's avatar
Jorran de Wit committed
var BundleTracker = require('webpack-bundle-tracker');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var glob = require("glob");
var path_bundles = __dirname + '/static/bundles/';

module.exports = {
    context: __dirname,
    entry: {
        main: glob.sync("./scipost/static/scipost/assets/css/*.css")
    },
    output: {
        path: path_bundles,
        publicPath: '/static/bundles/',
        filename: "js/[name]-[hash].js",
    },
    module: {
        loaders: [
            {
                test: /\.css$/,
                loader: ExtractTextPlugin.extract("style-loader", "css-loader")
            },
            // Optionally extract less files (yeay!)
            {
                test: /\.less$/,
                loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
            }
        ]
    },
    plugins: [
        new BundleTracker({filename: './webpack-stats.json'}),
        new ExtractTextPlugin('css/[name]-[hash].css'),
        new CleanWebpackPlugin(['css', 'js'], {
            root: path_bundles,
            verbose: true,
            dry: false,
            exclude: []
        })
    ]
}