Answer the question
In order to leave comments, you need to log in
What is the correct structure of static files in large projects?
Good day.
I have always been interested in the question of a good structure for static files - js, css, img.
At the moment I'm using something like this structure
├── /static
│ ├── /dist
│ │ ├── /js
│ │ │ ├── /apps -> это js скрипты разбросанные по модулям (app)
│ │ │ │ ├── /auth -> название модуля (app)
│ │ │ │ │ ├── login.js -> название вьюхи
│ │ │ ├── somescript.js
│ │ │ ├── src.js
│ │ │ ├── /lib -> библиотеки и скрипты
│ │ │ │ ├── /bootstrap-3.1.1 -> я использую версию в названии (стоит ли?)
│ │ │ │ │ ├── /js
│ │ │ │ │ │ ├── bootstrap.js
│ │ │ │ │ ├── /css
│ │ │ │ │ │ ├── bootstrap.css
│ │ │ │ │ ├── /plugins -> плагины и дополнения для библиотеки или скрипт
│ │ │ │ │ │ ├── /tablesorter
│ │ │ │ │ │ │ ├── /js
│ │ │ │ │ │ │ │ ├── tablesorter.js
│ │ │ │ │ │ │ ├── /css
│ │ │ │ │ │ │ │ ├── tablesorter.css
│ │ ├── /css
│ │ │ ├── somecss.css
Answer the question
In order to leave comments, you need to log in
1. All external libraries are connected only through bower
2. Own statics in the project/static/(css|less|js) directories. The structure of subdirectories depends on the framework and agreements between developers.
3. Everything is built/compressed via django-pipeline at the time of build and loaded into the CDN during deployment.
As a result, the outside world only sees static.example.com/frontend.HASH.css and static.example.com/frontend.HASH.js. Files are delivered in a compressed format and cached forever.
Profit!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question