Skip to content

Instantly share code, notes, and snippets.

@fimion
Created January 29, 2020 19:06
Show Gist options
  • Save fimion/ae3931fde960c299686c885f8c1a4c4d to your computer and use it in GitHub Desktop.
Save fimion/ae3931fde960c299686c885f8c1a4c4d to your computer and use it in GitHub Desktop.
const ListOfXML = [];
// https://webpack.js.org/guides/dependency-management/#require-context
const requireComponent = require.context(
// Look for files in a directory
'/path/to/xml/files',
// Do not look in subdirectories
false,
// Only include ".xml" files
/.*\.xml$/
)
// For each matching file name...
requireComponent.keys().forEach((fileName) => {
ListOfXML.push(filename);
})
export default ListOfXML
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment