diff --git a/webapp/nuxt.config.js b/webapp/nuxt.config.js index 17bb5290c..4a35e37f4 100644 --- a/webapp/nuxt.config.js +++ b/webapp/nuxt.config.js @@ -107,6 +107,7 @@ export default { ** Plugins to load before mounting the App */ plugins: [ + { src: '~/plugins/base-components.js', ssr: true }, { src: `~/plugins/styleguide${process.env.STYLEGUIDE_DEV ? '-dev' : ''}.js`, ssr: true, diff --git a/webapp/plugins/base-components.js b/webapp/plugins/base-components.js new file mode 100644 index 000000000..61a18c3fa --- /dev/null +++ b/webapp/plugins/base-components.js @@ -0,0 +1,11 @@ +import Vue from 'vue' + +const componentFiles = require.context('~/components/_new/generic', true, /Base[a-zA-Z]+\.vue/) + +componentFiles.keys().forEach(fileName => { + const component = componentFiles(fileName) + const componentConfig = component.default || component + const componentName = component.name || fileName.replace(/^.+\//, '').replace('.vue', '') + + Vue.component(componentName, componentConfig) +})