Skip to content

🔧 Change plugins to expect array of objects #39

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

Merged
merged 1 commit into from
Jun 6, 2017

Conversation

markbrouch
Copy link
Contributor

@markbrouch markbrouch commented Jun 6, 2017

This PR fixes the plugins signature to expect an array of objects, matching the Pug options API.

This allows user to pass arguments to the plugin:

...
{
  loader: 'pug-html-loader',
  options: {
    plugins: [
      myCustomPlugin(options),
      myOtherPlugin(),
      {  // or you could even inline a plugin here
        resolve(filename, source, options) {...}
      }
    ]
  }
},
...

You could also pass in pluggable override hooks in an object and pug-html-loader will wrap them into an array to pass to Pug as plugins:

...
{
  loader: 'pug-html-loader',
  options: {
    plugins: {
      resolve(filename, source, options) {...},
      lex() {...}
    }
  }
},
...

This also matches the webpack signature for plugins, providing additional familiarity.

@willyelm willyelm merged commit ee784fd into willyelm:master Jun 6, 2017
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.

2 participants