Dan
Dan

Reputation: 321

Use of vendor folder in web design

I am starting to build a website from scratch using python, django, and bootstrap. I have noticed that many times js, css, img. and fonts are stored in a folder vendor, such as:

/static/js/vendor/bootstrap/bootstrap.min.js
/static/css/vendor/bootstrap/bootstrap.min.css

or something similar.

What is the benefit of this folder structure over something like:

/static/bootstrap/js/bootstrap.min.js
/static/bootstrap/css/bootstrap.min.css

In the first example, when using the vendor folder as I have often seen, I would have to download bootstrap and unpack the downloaded folder into the js and css vendor sub-directories. In the second example, I can download bootstrap and drop the downloaded folder into /static without having to unpack anything.

Upvotes: 16

Views: 19208

Answers (2)

AndrewL64
AndrewL64

Reputation: 16311

The vendor folder is where you usually (I'm using the word 'usually' because it's not exactly a rule but more of a preference in the coding community with the purpose of having a semantic directory structure) keep third-party resources(icons, images, codes, you name it) as opposed to a lib (library) folder where you or the author of the site/application to be specific keep your original codes in.

So if I were to download and use the site/application in the hypothetical scenario above, I can then create relevant folders for each data type (src/images for images, style/css for css, script/js for js, etc) and move required assets from the lib folder to the new folders without having to edit the third-party codes (or other assets) thus making it easier to rollback on any changes made that cause errors and such.

Upvotes: 13

Quentin
Quentin

Reputation: 943585

It clearly marks which files are third-party libraries that should not be edited directly.

Upvotes: 19

Related Questions