Skip to content

Instantly share code, notes, and snippets.

@daniepetrov
Created June 28, 2019 14:21
Show Gist options
  • Save daniepetrov/7f45f6b41ff508cd896a48f8339e8bcc to your computer and use it in GitHub Desktop.
Save daniepetrov/7f45f6b41ff508cd896a48f8339e8bcc to your computer and use it in GitHub Desktop.
function importAll(r) {
const images = {}
r.keys().map(item => {
images[item.replace('./', '')] = r(item)
return null
})
return images
}
const images = importAll(require.context('./images', false, /\.(png|jpe?g|svg)$/))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment