Where to save SASS files in a Django project?

I understand that static files (e.g. CSS, JS, images) in a Django project are ideally stored in a directory static/, be it inside the application or the project root.

The sample folder structure may look like

project_root/my_app/static/my_app/css, jsor img, or project_root/static/project_name/css, jsorimg

In addition, I ran a team collectstaticto make them ready for service.

But my question is: where should I store SASS files? If I create the sass directory inside static/my_app/along with the directories css, jsand imgwill they not be available to the public when I make them ready for service?

What could be the best location / directory for storing SASS (or SCSS) files in a Django project so that they are not available to the public, since they will already be processed in CSS, which is finally available to the public? Also, please let me know if my concepts about static files are understood.

thank

+4
source share
1 answer

Store assets in a directory assets. Here is a simple project layout that I use (many things are omitted):

[project root directory]
          β”œβ”€β”€ apps/
          |    β”œβ”€β”€ [app]/
          |    └── __init__.py
          |
          β”œβ”€β”€ assets/
          |     β”œβ”€β”€ styles/ (css/)
          |     β”œβ”€β”€ fonts/
          |     β”œβ”€β”€ images/ (img/)
          |     └── scripts/ (js/)
          |
          β”œβ”€β”€ bin/
          β”œβ”€β”€ fixtures/
          β”œβ”€β”€ media/
          β”œβ”€β”€ docs/
          β”œβ”€β”€ requirements/
          β”œβ”€β”€ [project name]/
          |        β”œβ”€β”€ __init__.py
          |        β”œβ”€β”€ settings/
          |        β”œβ”€β”€ urls.py
          |        └── wsgi.py
          |
          β”œβ”€β”€ templates/
          |     β”œβ”€β”€ [app templates]/
          |     β”œβ”€β”€ base.html
          |     └── main.html
          |
          β”œβ”€β”€ manage.py
          β”œβ”€β”€ .gitignore
          β”œβ”€β”€ .gitmodules
          └── README

Sass CSS, . , (///) , / (+ minify/ougly/process whoever you want the way) static - - (, Gulp). ; Coffee Typescript assets/scripts, Javascript static. , , () .

+4

Source: https://habr.com/ru/post/1656824/


All Articles