- Add
@russmedia/theme-resolver
dependency to your project
npm install @russmedia/theme-resolver
- Use it in your Code
// define some options
const options = [
{
directories: [
path.resolve(__dirname, 'src', 'theme1', 'components') // path to some theme directory,
path.resolve(__dirname, 'src', 'theme2', 'components') // path to some different theme directory,
],
prefix: '@components'
},
]
// Create a new Instance
const instance = new ThemeResolver(options)
// Get correct resolver for a path
const path = '@components/test.vue'
const resolver = instance.getResolver(path)
// strip prefix from path
const filePath = instance.getFileName(path)
// resolveComponent
instance.resolveComponentPath(filePath, insance)
- Clone this repository
- Install dependencies using
yarn install
ornpm install
- Test code with
npx jest
Copyright (c) Julian Martin [email protected]