Skip to content
This repository has been archived by the owner on Sep 14, 2024. It is now read-only.

Consolidate plugin API #16

Open
brattonross opened this issue Dec 29, 2020 · 0 comments
Open

Consolidate plugin API #16

brattonross opened this issue Dec 29, 2020 · 0 comments

Comments

@brattonross
Copy link
Owner

Since we now support globs for the pagesDir option I think we can clean up the plugin API somewhat. Here's my initial idea for what it should look like:

// Use a string to set the pages directory, uses the default extensions
voie({
  pages: 'src/views'
})

// Use an object to set the directory and/or the extensions
voie({
  pages: {
    dir: 'src/views',
    extensions: ['ts']
  }
})

// Use an array to specify a list of directories to use
// Object syntax can be used inside the array if extensions need to be customized per-directory
voie({
  pages: [
    'module-a/pages',
    { dir: 'module-b/pages', extensions: ['ts', 'vue'] }
  ]
})

// Use an object with `dir` as an array when you want to set custom extensions for all paths
// Extensions can still be specified per-directory, so in this example
// ['ts'] will be used for `module-b/pages`, and ['tsx'] will be used for `module-a/pages`.
voie({
  pages: {
    dir: [
      'module-a/pages',
      { dir: 'module-b/pages', extensions: ['ts'] }
    ],
    extensions: ['tsx']
  }
})
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant