Commit e59d769d authored by Sli's avatar Sli

Doc for scss

parent 200af579
Pipeline #955 passed with stage
in 4 minutes and 17 seconds
...@@ -35,9 +35,11 @@ The development is done with sqlite, but it is advised to set a more robust DBMS ...@@ -35,9 +35,11 @@ The development is done with sqlite, but it is advised to set a more robust DBMS
### Collecting statics for production: ### Collecting statics for production:
We use scss in the project. In development environment (DEBUG=True), scss is compiled every time the file is needed. For production, it assumes you have already compiled every files and to do so, you need to use the following commands :
``` ```
./manage.py collectstatic ./manage.py collectstatic # To collect statics
./manage.py compilestatic ./manage.py compilestatic # To compile scss in those statics
``` ```
### Misc about development ### Misc about development
......
...@@ -30,6 +30,9 @@ from django.conf import settings ...@@ -30,6 +30,9 @@ from django.conf import settings
class Command(BaseCommand): class Command(BaseCommand):
"""
Compiles scss in static folder for production
"""
help = "Compile scss files from static folder" help = "Compile scss files from static folder"
def compile(self, filename): def compile(self, filename):
......
...@@ -34,6 +34,11 @@ from core.scss.storage import ScssFileStorage, find_file ...@@ -34,6 +34,11 @@ from core.scss.storage import ScssFileStorage, find_file
class ScssProcessor(object): class ScssProcessor(object):
"""
If DEBUG mode enabled : compile the scss file
Else : give the path of the corresponding css supposed to already be compiled
Don't forget to use compilestatics to compile scss for production
"""
prefix = iri_to_uri(getattr(settings, 'STATIC_URL', '/static/')) prefix = iri_to_uri(getattr(settings, 'STATIC_URL', '/static/'))
storage = ScssFileStorage() storage = ScssFileStorage()
scss_extensions = [".scss"] scss_extensions = [".scss"]
......
...@@ -53,5 +53,8 @@ def datetime_format_python_to_PHP(python_format_string): ...@@ -53,5 +53,8 @@ def datetime_format_python_to_PHP(python_format_string):
@register.simple_tag() @register.simple_tag()
def scss(path): def scss(path):
"""
Return path of the corresponding css file after compilation
"""
processor = ScssProcessor(path) processor = ScssProcessor(path)
return processor.get_converted_scss() return processor.get_converted_scss()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment