# vue-initializers

> Cleanly configure your Vue application as it boots

Latest version **1.0.0** (published 2020-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-initializers
pnpm add vue-initializers
yarn add vue-initializers
bun add vue-initializers
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-09-14 |
| First published | 2020-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Maros Hluska |
| Maintainers | mhluska |
| Keywords | vue, vue-plugin, initializers, configuration |

## Links

- npm: https://www.npmjs.com/package/vue-initializers
- Repository: https://github.com/mhluska/vue-initializers
- Homepage: https://github.com/mhluska/vue-initializers#readme
- Issues: https://github.com/mhluska/vue-initializers/issues
- npm.io page: https://npm.io/package/vue-initializers

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-09-14
- 0.0.1 — 2020-09-13

## README

<!--
<p align="center">
  <img width="450" src="" alt="Preview" />
</p>
-->

<p align="center">
  <a href="https://github.com/mhluska/vue-initializers/actions"><img src="https://github.com/mhluska/vue-initializers/workflows/tests/badge.svg?branch=master" alt="Build Status" /></a>
  <a href="https://www.npmjs.com/package/vue-initializers"><img src="https://img.shields.io/npm/v/vue-initializers.svg" alt="Version"></a>
  <a href="https://github.com/mhluska/vue-initializers/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mhluska/vue-initializers?cache=false" alt="License"></a>
</p>

<p align="center">
  Cleanly configure your Vue application as it boots
</p>

## Installation

An initializer is a JavaScript file placed under `/src/initializers` in your
application. You can use initializers to hold configuration settings that run as
your application boots.

```sh
npm install --save vue-initializers
```

Install `VueInitializers` as early as possible in your `src/main.js` file:

```js
import Vue from 'vue';
import VueInitializers from 'vue-initializers';

Vue.use(VueInitializers, {
  // Tells Webpack to read the contents of the `initializers` dir at build time.
  requires: require.context('@/initializers', false, /\w+\.js$/),

  // Prints optional debug information to console.
  // debug: true,
});

import App from '@/App';

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

## Usage

Initializers should export a function which accepts `Vue` as a parameter. A
common use case for initializers is to hold initialization code for other
plugins:

```js
import VueProgressBar from 'vue-progressbar';

export default function (Vue) {
  Vue.use(VueProgressBar, {
    color: '#0366d6',
  });
}
```

Sometimes you may want to force an initializer to run before others. In that
case, return an object with a `handler` property and one of `index`, `before` or
`after`:

```js
import { init } from '@sentry/browser';

export default {
  // Provide another initializer's filename to ensure this runs before.
  // before: ''

  // Or provide one to ensure this runs after.
  // after: ''

  // Alternatively, pass an index to give an exact position in the run order.
  // `index: 0` ensures this initializer loads first.
  index: 0,

  handler(Vue) {
    init(/* ... */);
  },
};
```

---
_Source: https://npm.io/package/vue-initializers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
