webpack-contrib / css-minimizer-webpack-plugin

cssnano plugin for Webpack
MIT License
318 stars 30 forks source link

output multiple css-files #100

Closed MarkusHeinisch closed 3 years ago

MarkusHeinisch commented 3 years ago

Hi there. How can i output 2 css-files - in my case a main.css (wordpress frontend) and editor.css (wordpress backend)? Currently i'am outputting only the minified main.css.

Code below or https://github.com/MarkusHeinisch/wordpress-tailwind-boilerplate/blob/main/assets/webpack.config.js

`const path = require('path'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin');

const SRC = 'src'; const JS_DIR = path.resolve(dirname, SRC + '/js'); const IMAGE_DIR = path.resolve(__dirname, SRC + '/images'); const FONT_DIR = path.resolve(dirname, SRC + '/fonts'); const OUTPUT_DIR = path.resolve(__dirname, 'out');

module.exports = { entry: { main: JS_DIR + '/main.js', editor: JS_DIR + '/editor.js', }, output: { path: OUTPUT_DIR, filename: 'js/[name].js', clean: true, }, plugins: [ new MiniCssExtractPlugin({ filename: 'css/[name].css', }), new CopyPlugin({ patterns: [ { from: IMAGE_DIR, to: 'images/[name][ext]', }, { from: FONT_DIR, to: 'fonts/[name][ext]', }, ], }), ], module: { rules: [ { test: /.(s[ac]|c)ss$/i, exclude: /node_modules/, use: [ MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader', 'sass-loader', ], }, ], }, optimization: { minimizer: [..., new CssMinimizerPlugin()], }, externals: { jquery: 'jQuery', }, }; `

alexander-akait commented 3 years ago

Thank you for creating this issue. However, issues need to follow one of our templates so that we can clearly understand your particular circumstances.

Please help us help you by recreating the issue using one of our templates.