Giter Club home page Giter Club logo

Comments (6)

ansenhuang avatar ansenhuang commented on June 14, 2024 5

I finded the solution, we can pass by some option to cssnano, please view following example:

new OptimizeCssAssetsPlugin({
    assetNameRegExp: /\.css$/g,
    cssProcessorOptions: {
      safe: true,
      autoprefixer: { disable: true },
      mergeLonghand: false,
      discardComments: {
        removeAll: true
      }
    },
    canPrint: true
  });

the option of autoprefixer: { disable: true } will disable cssnano's autoprefixer and saved prefixer that already exist by ourselves.

from optimize-css-assets-webpack-plugin.

ansenhuang avatar ansenhuang commented on June 14, 2024

So what can I do ?

from optimize-css-assets-webpack-plugin.

zhangolve avatar zhangolve commented on June 14, 2024

me too.

from optimize-css-assets-webpack-plugin.

NMFR avatar NMFR commented on June 14, 2024

By default the CSS manipulation that this plugin does is delegated to cssnano. You can control the cssnano config in the cssProcessorOptions option.

This is a cssnano related issue.

from optimize-css-assets-webpack-plugin.

malcolm-kee avatar malcolm-kee commented on June 14, 2024

I able to make it work, sharing here just in case anyone stumble upon same issue.

It seems like if you set browserslist key in your package.json, then the optimization will remove the prefix only if the prefix is not required based on your browserlist. Autoprefixer has a section that explains this in its docs.

Example of browserslist:

{
"browserslist": [
    ">1%",
    "last 4 versions",
    "not ie < 9"
  ]
}

from optimize-css-assets-webpack-plugin.

blue-lightning avatar blue-lightning commented on June 14, 2024

While ansenhuang's answer is correct, if you want to only disable Autoprefixer's remove outdated prefixes function and keep everything else, replace disable: true with remove: false.

from optimize-css-assets-webpack-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.