H
H
houdy222020-02-26 11:24:00
css
houdy22, 2020-02-26 11:24:00

How to generate two css files in Webpack (minified and not)?

There is a task to configure the webpack assembly to create two css files (minified and normal). I can't figure out how to do it. It is necessary to generate two output files from the same css input files.

Now it looks like this for me:

module.exports = {
   ...
   plugins: [
      ...
      new MiniCssExtractPlugin({
         filename: (isProd) ? '[name].css' : '[name].[contenthash].css'
      }),
      ...
   ],
   module: {
      rules: [
         {
            test: /\.(sa|sc|c)ss$/,
            use: [
               {
                  loader: MiniCssExtractPlugin.loader,
                  options: {
                     hmr: isDev,
                     reloadAll: true,
                  },
               },
               'css-loader',
               'postcss-loader',
               'sass-loader',
               'webpack-import-glob-loader'
            ]
         },
      ...
      ]
   }
}


Perhaps someone faced such a task or can tell in which direction to dig?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question