chore: add data and lunr via plugins
this way lunr is only set up once, which speeds up the loading of the search page. also makes sure the data doesn't increadse the bundle sizes of the various pages that use it.
This commit is contained in:
@@ -1,6 +1,23 @@
|
||||
import Vue from 'vue';
|
||||
import Router from 'vue-router';
|
||||
import './filters.mjs';
|
||||
import strainData from './plugins/strainData.mjs';
|
||||
import lunr from './plugins/lunr.mjs';
|
||||
|
||||
Vue.use(strainData);
|
||||
|
||||
Vue.use(
|
||||
lunr(function lunrSetup() {
|
||||
// lunr search index setup
|
||||
this.ref('id');
|
||||
this.field('name');
|
||||
this.field('effects');
|
||||
this.field('uses');
|
||||
this.field('conditions');
|
||||
this.field('flavors');
|
||||
Vue.prototype.$strainData.strains.forEach(doc => this.add(doc));
|
||||
})
|
||||
);
|
||||
|
||||
Vue.use(Router);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user