Where to keep SASS files in a Django project?
<p>I understand that static files (such as CSS, JS, images) in a Django project are ideally to be kept in a <code>static/</code> directory, whether inside an app or the project root.</p>

<p>A sample folder structure may look like</p>

<p><code>project_root/my_app/static/my_app/css</code>, <code>js</code> or <code>img</code>, or
<code>project_root/static/project_name/css</code>, <code>js</code> or <code>img</code></p>

<p>Also, I will run <code>collectstatic</code> command to make them ready to be served.</p>

<p>But my question is where should I keep my SASS files? If I create a sass directory inside <code>static/my_app/</code> along with <code>css</code>, <code>js</code> and <code>img</code> directories, won't they become available to public when I make them ready to be served?</p>

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

<p>Thank you</p>

<p>Keep assets in <code>assets</code> directory. Here is simple project layout I use (many things are omitted):</p>

<pre><code>[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
</code></pre>

<p>Sass files are compiled to CSS so they need to kept apart. Good practice is to have all assets (styles/fonts/images/scripts) in one subdirectory and then compile/copy them (+ minify/ugly/process whoever you want along the way) to <code>static</code> directory with some kind of task-runner (for example Gulp). Same goes for scripts; you can keep Coffee or Typescript files in <code>assets/scripts</code> and then compile them to Javascript files in <code>static</code>. This way only final files are available to user and are nicely separated from what you (developer) work on. </p>

python django sass