If I have a file tree like so:
└── playground
└── static
├── css
├── images
├── js
└── vendor
When should I put files in vendor, and when should I put in any of the other folders? I do not know if it matters that I am asking this to help me build a flask application. Is there any documentation for best practices on static file structure?
It really depends on how you want to organize your static folder.
Any CSS file you create should go in css
, any javascript file you create should go in js
and from what I can gather, vendor is for any third-party CSS and JS you want to host. For example if you are using a CSS framework such as bootstrap, then you'll have a bootstrap.min.css
file, a file you didn't create or generate. The same for any Javascript library such as jquery or any other you downloaded.
In the end it will depend on what you need, for example by putting third-party CSS and JS files in the vendor
folder, which are files that are probably not going to change, its easier to tell for example nginx to cache files requested under /static/vendor
and not /static/css
which is likely to change.