Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The v5 plugin API was not updated to support cssnano v4 #69

Closed
jzempel opened this issue Jul 27, 2018 · 4 comments
Closed

The v5 plugin API was not updated to support cssnano v4 #69

jzempel opened this issue Jul 27, 2018 · 4 comments

Comments

@jzempel
Copy link

jzempel commented Jul 27, 2018

v5.0.0 was a breaking change in that it was updated to depend on cssnano v4.0.2. However, this plugin was not updated to receive options per the PostCSS 6.x breaking change described by cssnano.

Please see https://cssnano.co/guides/presets/ for updated API details.

For example, attempt the following:

new OptimizeCSSAssetsPlugin({
  cssProcessorOptions: { /* update API to receive a cssPluginOptions? */
    preset: [
      'default',
      {
        cssDeclarationSorter: false,
        normalizeWhitespace: false
      }
    ]
  }
});

Result: declarations will still be sorted and whitespace will be compressed by cssnano 4.

Reference:

@rofrol
Copy link

rofrol commented Jul 30, 2018

To disable certain plugins, you need to do it in package.json:

  "cssnano": {
    "preset": [
      "default",
      {"cssDeclarationSorter": {"exclude": true}}
    ]
  }

or in postcss.config.js:

module.exports = {
    plugins: [
        require('cssnano')({
            preset: ['default', {
                cssDeclarationSorter: {
                    exclude: true,
                },
            }],
        }),
    ],
};

Disabling in webpack.config.js or cssnano.config.js like descibed here, doesn't work.

@jzempel
Copy link
Author

jzempel commented Jul 30, 2018

I see what you're saying @rofrol. But the plugin's API could be updated to receive cssPluginOptions, right? If so, then it would continue to function in the manner it did prior to v5.0.0 where inlined options were applied to the cssnano transform.

@rofrol
Copy link

rofrol commented Jul 31, 2018

But your plugin's API

@jzempel It's not my plugin

@NMFR
Copy link
Owner

NMFR commented Aug 29, 2018

#73 solved this.

If not tell me so i can reopen the issue.

@NMFR NMFR closed this as completed Aug 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants