christianalfoni / webpack-express-boilerplate

A boilerplate for running a Webpack workflow in Node express
MIT License
1.39k stars 291 forks source link

How to add static assets? #20

Closed Kadrian closed 8 years ago

Kadrian commented 8 years ago

I created a dist folder and referenced it directly from my html file with a <link> tag. That worked. But that's certainly not how it's intended, since the dist directory is on .gitignore by default, right?

The same applies to images / fonts and so on. How to reference them?

Kadrian commented 8 years ago

Okay, so I think I understand webpack a little better: Webpack will handle all static assets through URLs and requires in my project. In the beginning it parses my project using the entry point main.js. Then I have to require fonts and everything else in there somehow, right?

enguyen commented 8 years ago

@Kadrian These instructions worked for me for SVG files, for example. Should work for many others as well: https://github.com/christianalfoni/react-webpack-cookbook/wiki/Loading-SVG

christianalfoni commented 8 years ago

Closing this for now, please reopen if more issues. Thanks for helping out @enguyen :-)