Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Load all Vue components from a given folder, no need for an "index.js"-file
const req = require.context('./components/', true, /\.(js|vue)$/i);
req.keys().map(key => {
const name = key.match(/\w+/)[0];
return Vue.component(name, req(key))

This comment has been minimized.

Show comment Hide comment

sagalbot Oct 21, 2017

Nice, thanks!

Nice, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment