forked from bootstrap-vue/bootstrap-vue
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathplugin.template.js
35 lines (29 loc) · 1.19 KB
/
plugin.template.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import Vue from 'vue';
<% if (!options.treeShake) { %>
<% if (options.icons) { %>
import { BootstrapVue, BootstrapVueIcons } from 'bootstrap-vue';
Vue.use(BootstrapVue, <%= JSON.stringify(options.config || {}, undefined, 2) %>);
Vue.use(BootstrapVueIcons);
<% } else { %>
import { BootstrapVue } from 'bootstrap-vue';
Vue.use(BootstrapVue, <%= JSON.stringify(options.config || {}, undefined, 2) %>);
<% } %>
<% } %>
<% if (options.treeShake) { %>
import {
<%= [].concat(
options.config ? 'BVConfigPlugin' : null,
options.componentPlugins,
options.directivePlugins,
options.components,
options.directives
).filter(Boolean).join(',\n ') %>
} from 'bootstrap-vue';
<% if (options.config) { %>
Vue.use(BVConfigPlugin, <%= JSON.stringify(options.config, undefined, 2) %>);
<% } %>
<%= options.componentPlugins.reduce((acc, plugin) => (acc += `Vue.use(${plugin});\n` ), '') %>
<%= options.directivePlugins.reduce((acc, plugin) => (acc += `Vue.use(${plugin});\n` ), '') %>
<%= options.components.reduce((acc, c) => (acc += `Vue.component('${c}', ${c});\n` ), '') %>
<%= options.directives.reduce((acc, d) => (acc += `Vue.directive('${d.replace(/^VB/, 'B')}', ${d});\n` ), '') %>
<% } %>