Do webpack 5 have a compression plugin which compress css file without validating css rules?

16 views Asked by At

I have some programming logic in css file. I used the css file as a template. Is there any plugin for webpack which has option to just compress the css file without validating css rules?

1

There are 1 answers

0
Shamim On

I found my solution with CopyWebpackPlugin and uglyfycss plugins

  plugins: [
    new CopyWebpackPlugin({
        patterns: [
            {
                from: 'styles/cssfolder/*.css',
                to: './styles/[name].min[ext]',
                transform: (content, path) =>
                    uglifycss.processFiles([path], {
                        maxLineLen: 500,
                        expandVars: true,
                        uglyComments: true
                    })
            }
        ]
    })
],