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

Fix example in README #8

Closed
wants to merge 1 commit into from

Conversation

davidtheclark
Copy link
Contributor

Just added () when bemLinter is invoked, because otherwise the plugin won't actually run.

Intest.js, that's how it is invoked: postcss().use(linter()).process(css);.

Alternately, index.js could be modified to return a function with the parameters (css, opts), as explained here: https://github.com/postcss/postcss#processor --- then linter could be invoked without the (), I believe.

Just added `()` when `bemLinter` is invoked, because otherwise the plugin won't actually run.

In`test.js`, that's how it is invoked: `postcss().use(linter()).process(css);`.

Alternately, `index.js` could be modified to return a function with the parameters `(css, opts)`, as explained here: https://github.com/postcss/postcss#processor --- then `linter` could be invoked without the `()`, I believe.
@davidtheclark
Copy link
Contributor Author

This comment from @ai applies: postcss/postcss#149 (comment)

@ai
Copy link
Member

ai commented Feb 5, 2015

We had a onversation here: postcss/postcss#149

Let’s wait for issues in plugins until we finish plugin guidelines.

@ai
Copy link
Member

ai commented Feb 5, 2015

But I really think that we should allow to miss () without a options. In all examples you do not use require('plugin-name') and it is a mistake. Most of PostCSS user cases will looks like:

postcss([ require('plugin1'), require('plugin2') ]);

Nobody will save 10-15 plugins to variables to use them only once.

And in this cases require('plugin')() looks weird.

@ai
Copy link
Member

ai commented Feb 5, 2015

But the main reason is that require('plugin')() is unsafe. If you will forgot about () (and new users always don’t read docs carefully) your plugin will not work without any warning.

@necolas
Copy link
Contributor

necolas commented Mar 13, 2015

Fixed by #13

@necolas necolas closed this Mar 13, 2015
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

Successfully merging this pull request may close these issues.

4 participants