0

I'm creating a React + Flux web app with a file structure that looks like this:

MyApp
|---
|---scripts
    |---app.jsx
    |---actions
    |---components
        |---HomePage.react.jsx
        |---NotFoundPage.react.jsx  
        |--- ...etc
    |---dispatcher
    |---stores

1) Where do I place public assets like pictures, videos, text files or whatever..

2) Is there a standard/neat way to load them? All I've found is this library but there must be something more people use.

SudoPlz
  • 20,996
  • 12
  • 82
  • 123
  • Depends on the size of your project.. small projects I just dump them all in a `/public` folder (maybe broken into `/img`, `/media` etc), and for large projects I usually dish them up via a NodeJS server (or similar) – Alex McMillan Jun 06 '15 at 08:28

1 Answers1

1

I usually use a dist or public folder where all asset are kept. When I release the app, the bundles are saved in the dist folder.

For example:

MyApp
|-- app
|    |---app.jsx
|    |---actions
|    |---components
|        |---HomePage.react.jsx
|        |---NotFoundPage.react.jsx  
|        |--- ...etc
|    |---dispatcher
|    |---stores
|-- public
     | -- js -- bunlde.js
     | -- img -- images
     | -- css -- app.css

Is there a standard/neat way to load them? All I've found is this library but there must be something more people use.

You can just include them in the index.html. However, recently I've been bundling the css into the javascript file so that I have one single file. You can do that with:

Giuseppe Pes
  • 7,772
  • 3
  • 52
  • 90