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

undefined [postcss-discard-empty] #212

Closed
lukasoppermann opened this issue Jun 20, 2016 · 7 comments
Closed

undefined [postcss-discard-empty] #212

lukasoppermann opened this issue Jun 20, 2016 · 7 comments
Labels

Comments

@lukasoppermann
Copy link

@lukasoppermann lukasoppermann commented Jun 20, 2016

Hey,

so using css with gulp & postcss I always get this "warning":

resources/css/app.css
undefined [postcss-discard-empty]

If I remove cssnano, the message disappears. Am I doing something wrong? Is there any more information I can provide to help solve this issue?

@ben-eb ben-eb added the question label Jun 20, 2016
@ben-eb

This comment has been minimized.

Copy link
Collaborator

@ben-eb ben-eb commented Jun 20, 2016

Hello,

I think you are seeing the "status" messages that are being set. We introduced this change here: ben-eb/postcss-discard-empty@c52c3c5.

My guess is that you have postcss-reporter installed and that is outputting these messages. Note that you can whitelist the plugins that you want to see messages from by using the plugins option.

@mikestopcontinues

This comment has been minimized.

Copy link

@mikestopcontinues mikestopcontinues commented Jun 20, 2016

Two things, however:

  1. This particular message is useless. Why would we need a warning to say discard-empty is doing its job? And why not the rest of the plugin chain?
  2. We'd want to see important messages from cssnano in postcss-reporter.
@ben-eb

This comment has been minimized.

Copy link
Collaborator

@ben-eb ben-eb commented Jun 20, 2016

  1. I added it because one of our users needed this functionality, so it is not useless. Furthermore it is not a warning, but a status message. Ideally any consumer of these messages should be able to tell this by the fact that each message that is produced does not bear the warning type. As for the rest of the plugins, nobody has offered to contribute code that fulfils this purpose, nor asked for this functionality, so unfortunately it is low on my priority list.
  2. Definitely, and this is an area in which I would like to improve, but as you can appreciate I do this project in my spare time. If you agree & think it'd be worth adding more status messages from plugins then contributions (in the same vein as ben-eb/postcss-discard-empty#9) are most welcome.
@zd-dalibor

This comment has been minimized.

Copy link

@zd-dalibor zd-dalibor commented Aug 5, 2016

I hove nothing against logging messages bot this message is useless just as @mikestopcontinues said.
Ok for this part of message [postcss-discard-empty] I now that something is discarded but what undefined means? What was discarded? What is line number of discarded things? ...

If undefined means that "postcss-discard-empty" plugin is only started but nothing has discarded than this message is ridiculous.

@ben-eb

This comment has been minimized.

Copy link
Collaborator

@ben-eb ben-eb commented Aug 5, 2016

undefined is being returned because the status message that we yield here does not have a message property. Is there any value in adding one, given that these are status messages which are not intended to be reported but consumed by other plugins?

Like I wrote above, you should exclude postcss-discard-empty with the plugins option from postcss-reporter if you don't want to see these messages.

@mech

This comment has been minimized.

Copy link

@mech mech commented Sep 23, 2016

If you using postcss-nesting which will unfortunately output empty rule as depicted here jonathantneal/postcss-nesting#19, then you will probably see this being reported.

@neocolmartin

This comment has been minimized.

Copy link

@neocolmartin neocolmartin commented Mar 16, 2017

To give an explicit example of what was mentioned in an earlier comment:
I managed to suppress those messages by changing my webpack.config.prod.js file's postcss entry from this:

  postcss: () => [
    // ...
    postcssReporter({
      clearMessages: true
    }),
    // ...
  ],

to:

  postcss: () => [
    // ...
    postcssReporter({
      clearMessages: true,
      plugins: ['!postcss-discard-empty']
    }),
    // ...
  ],

I'm not sure if there are any other messages that postcss-discard-empty might emit that I might miss, but it certainly suppresses these ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.