thelounge/client/components/MessageTypes/index.js

14 lines
486 B
JavaScript
Raw Normal View History

2018-07-09 12:44:12 +02:00
"use strict";
// This creates a version of `require()` in the context of the current
// directory, so we iterate over its content, which is a map statically built by
// Webpack.
// Second argument says it's recursive, third makes sure we only load templates.
const requireViews = require.context(".", false, /\.vue$/);
2019-11-16 18:24:03 +01:00
export default requireViews.keys().reduce((acc, path) => {
2018-07-09 12:44:12 +02:00
acc["message-" + path.substring(2, path.length - 4)] = requireViews(path).default;
return acc;
}, {});