L
L
Lorem Ipsum2014-06-19 18:33:52
css
Lorem Ipsum, 2014-06-19 18:33:52

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

So, I don’t really like this structure, because it’s not comme il faut and in a large project it’s difficult to keep track of what is connected and what is not.
I would like to use something like require.js , but for it you need to redo the structure.
And here's the question itself, please tell me a good structure for static files, for example, the one you use yourself, or some links to articles.
I write in django.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
optio, 2014-06-19
@optio

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!

L
Lisonok, 2014-06-19
@Lisonok

Read about BEM en.bem.info/method/filesystem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question