Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Messages can't be disabled in CLI #192

Closed
jeluard opened this issue Aug 11, 2015 · 5 comments · Fixed by #238
Closed

Messages can't be disabled in CLI #192

jeluard opened this issue Aug 11, 2015 · 5 comments · Fixed by #238

Comments

@jeluard
Copy link

jeluard commented Aug 11, 2015

It would be nice to be able to disable messages when using cssnext CLI. Also you might want to consider having the browser messages disabled by default as this is pretty intrusive and can't be hidden (I'm using a CSS DSL that generates some invalid CSS and always trigger the reporter).

@MoOx
Copy link
Owner

MoOx commented Aug 11, 2015

One workaround is to make a plugin that will remove some messages you don't want to see

// cssnext config
{
  plugins: [
    function(css, result) {
      for(var i=0; i < result.messages.length; i++) {
        if (result.messages[i].text == "THE WARNING YOU HATE") {
          result.messages = result.messages.slice(0,i).concat(result.messages.slice(i+1))
        }
    }
  ]
}

You can use a regex using ...text.match(/regex/) if messages are dynamic.

@jeluard
Copy link
Author

jeluard commented Aug 11, 2015

Can I do that when using cssnext CLI? I'm using it as a shell command from a build tool without node support.

@MoOx
Copy link
Owner

MoOx commented Aug 11, 2015

I think CLI support a config file. Try $ cssnext --help.
Your file might be a .js and like this

module.exports = {
  // cssnext config here
}

@jeluard
Copy link
Author

jeluard commented Aug 12, 2015

It works perfect thanks!

For the record I used cssnext -C config.js

with config.js

module.exports = {
  messages: false
}

@MoOx MoOx mentioned this issue Dec 29, 2015
5 tasks
@MoOx MoOx closed this as completed in #238 Jan 4, 2016
@MoOx
Copy link
Owner

MoOx commented Jan 4, 2016

postcss-cssnext do not handle messages anymore (cssnext is now postcss-cssnext. cssnext is deprecated.) See postcss-cssnext migration guide http://cssnext.io/postcss/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants