vue-autowire

Autowiring plugin for VueJS
2,057 7
Install
npm install vue-autowire
Latest Version:0.2.2
Vue:2
License:MIT
Last Updated:Dec 9, 2022
Links: GitHub  ·  npm
Maintainer: kaizendorks

vue-autowire

In development!

Build Status

Vue Autowire is a Vue plugin with conventions for automatically wiring different Vue assets:

  • components
  • views
  • directives
  • filters
  • mixins
  • routes

Quick usage on a Vue-CLI project

import Vue from 'vue'
import App from './App.vue'
import VueAutowire from 'vue-autowire'

// Use the default conventions
import defaultConventions from 'vue-autowire/src/conventions';
Vue.use(VueAutowire, defaultConventions)

Vue.config.productionTip = false

new Vue({
  render: h => h(App),
}).$mount('#app')

Auto wire only certain assets, but with their default conventions

import componentsConventions from 'vue-autowire/src/conventions/components';
Vue.use(VueAutowire, componentsConventions)

Mix and match defaults and your custom conventions

import componentsConventions from 'vue-autowire/src/conventions/components';
Vue.use(VueAutowire, Object.assign(componentsConventions, {
  views: {
    // Provide your own views convention. For example:
    // register all .vue files (excluding .local.vue and .async.vue) inside the /views folder as regular components
    requireContext: require.context('./views', true, /\/(?:[^.]+|(?!\.local\.vue$)|(?!\.async\.vue$))\.vue$/),
    // register all .async.vue files inside the /views folder as dynamic components
    requireAsyncContext: require.context('./views', true, /\.async\.vue$/, 'lazy'),
  }
}))

Read through the docs at https://kaizendorks.github.io/vue-autowire/ for more information about the default conventions and how to create your own.

Related Packages

vue

The progressive JavaScript framework for building modern web UI.

588,019,132 54,801
vue
@vueuse/shared
372,738,348 22,398
@vueuse/core

Collection of essential Vue Composition Utilities

367,188,523 22,398
@vitejs/plugin-vue

The official plugin for Vue SFC support in Vite.

333,357,380 686
eslint-plugin-vue

Official ESLint plugin for Vue.js

266,364,830 4,591

Version History

Version Released Vue License
0.2.2 ^2.6.11 MIT
0.2.1 ^2.6.11 MIT
0.2.0 ^2.6.11 MIT
0.1.9 ^2.5.16 MIT
0.1.8 ^2.5.16 MIT