@russmedia/theme-resolver
v1.0.0
Published
[![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href] [![CircleCI][circle-ci-src]][circle-ci-href] [![Codecov][codecov-src]][codecov-href] [![License][license-src]][license-href]
Downloads
844
Readme
@russmedia/theme-resolver
Setup
- 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)
Development
- Clone this repository
- Install dependencies using
yarn install
ornpm install
- Test code with
npx jest
License
Copyright (c) Julian Martin [email protected]