Advertisement
Armandobs14

importing images from context

Jul 27th, 2017
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. importAll(r) {
  2.     let k = r.keys().map(n => n.replace('./',''));
  3.     let map = r.keys().map(r);
  4.     return (((o,a,b)=>(a.forEach((c,i)=>o[c]=b[i])||o)))({},k,map);
  5.   }
  6.  
  7. importAll(require.context('./assets', false, /\.(png|jpe?g|svg)$/))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement