Fixes instructions on admin themes view

This commit is contained in:
Mouse Reeve 2022-03-13 11:36:31 -07:00
parent 9f19fb698b
commit 0c87ee1d4b
3 changed files with 2 additions and 34 deletions

View file

@ -1,32 +0,0 @@
""" Compile themes """
import os
from django.contrib.staticfiles.utils import get_files
from django.contrib.staticfiles.storage import StaticFilesStorage
from django.core.files.base import ContentFile
from django.core.management.base import BaseCommand
import sass
from sass_processor.processor import SassProcessor
# pylint: disable=line-too-long
class Command(BaseCommand):
"""Compile themes"""
help = "Compile theme scss files"
# pylint: disable=no-self-use,unused-argument
def handle(self, *args, **options):
"""compile themes"""
storage = StaticFilesStorage()
theme_files = list(get_files(storage, location="css/themes"))
theme_files = [t for t in theme_files if t[-5:] == ".scss"]
for filename in theme_files:
path = storage.path(filename)
content = sass.compile(
filename=path,
include_paths=SassProcessor.include_paths,
)
basename, _ = os.path.splitext(path)
destination_filename = basename + ".css"
print(f"saving f{destination_filename}")
storage.save(destination_filename, ContentFile(content))

View file

@ -29,7 +29,7 @@
{% trans "Copy the theme file into the <code>bookwyrm/static/css/themes</code> directory on your server from the command line." %}
</li>
<li>
{% trans "Run <code>./bw-dev compilescss</code>." %}
{% trans "Run <code>./bw-dev collectstatic</code>." %}
</li>
<li>
{% trans "Add the file name using the form below to make it available in the application interface." %}

2
bw-dev
View file

@ -154,7 +154,7 @@ case "$CMD" in
--config dev-tools/.stylelintrc.js
;;
compilescss)
runweb python manage.py compilethemes
runweb python manage.py compilescss
runweb python manage.py collectstatic --no-input
;;
collectstatic_watch)