1.0.0 • Published 3 years ago

@russmedia/theme-resolver v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

@russmedia/theme-resolver

npm version npm downloads CircleCI Codecov License

📖 Release Notes

Setup

  1. Add @russmedia/theme-resolver dependency to your project
npm install @russmedia/theme-resolver
  1. 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)

Development

  1. Clone this repository
  2. Install dependencies using yarn install or npm install
  3. Test code with npx jest

License

MIT License

Copyright (c) Julian Martin julian.martin@russmedia.com