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

Use PostCSS-like plugin function? #697

Closed
ambar opened this issue Jul 11, 2018 · 0 comments
Closed

Use PostCSS-like plugin function? #697

ambar opened this issue Jul 11, 2018 · 0 comments

Comments

@ambar
Copy link
Contributor

ambar commented Jul 11, 2018

It's much easier to define user options and resolve local/scoped plugins:

// current API
function modify(config, _, __, userOptions = {}) {

}


{
  plugins: [
    {func: modify, options: {...}},
  ]
}

vs.

// PostCSS-like API
const modify = userOptions => config => {

}


{
  plugins: [
    modify({...}),
  ]
}

PostCSS plugin:

{
  plugins: [
    require('postcss-plugin-foo')(options),
    require('./myPlugin')(options),
  ]
}

Next.js plugin:

// next.config.js
const withCSS = require('@zeit/next-css')
module.exports = withCSS({
  cssModules: true,
})

Babel plugin:

{
  plugins: [
    [require('babel-plugin-foo'), options],
    [require('./myPlugin'), options],
  ]
}

Gatsby plugin:

{
  plugins: [
    {
      resolve: 'gatsby-plugin-foo',
      options: {},
    },
  ]
}
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

1 participant