Skip to content

Commit

Permalink
feat: add initial plugin functionality with USWDS setting definitions
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #99
  • Loading branch information
patrickcate committed Nov 7, 2021
1 parent 7a39e09 commit ffa2408
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
25 changes: 25 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import pkg from '../package.json'
import { nextId } from '@/utils/unique-id.js'

export default {
install: (app, options) => {
const customOptions = options || {}

const vueUswdsOptions = {
prefixSeparator: ':',
gridNamespace: 'grid-',
utilityNamespace: 'u-',
imagePath: '/assets',
svgSpritePath: '/assets/sprite',
...customOptions,
version: pkg.version,
}

if (!app.config.globalProperties.$vueUswds) {
app.config.globalProperties.$vueUswds = vueUswdsOptions
}

app.provide('vueUswds', vueUswdsOptions)
app.provide('nextId', () => nextId(app.config.globalProperties))
},
}
8 changes: 6 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import '../node_modules/uswds/dist/css/uswds.min.css'
import { createApp } from 'vue'
import App from './App.vue'
import vueUswds from '@/index.js'
import App from '@/App.vue'

createApp(App).mount('#app')
const app = createApp(App)
app.use(vueUswds, {})
app.mount('#app')

0 comments on commit ffa2408

Please sign in to comment.