Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,25 @@ SASS_BIN = '/usr/bin/sass' # location of the sass binary
As well, you will need a dictionary to define the sass input and output files.

SASS = (
{
'name' : 'test',
'details' : {
'input' : 'sass/test.sass',
'output' : 'css/test.css',
{
'name' : 'test',
'details' : {
'input' : ROOT_DIR + '/app/static/app/sass/test.sass',
'output' : ROOT_DIR + '/app/static/app/css/test.css',
}
},
{
'name' : 'test2',
'details' : {
'input' : 'sass/test2.sass',
'output' : 'css/test2.css',
{
'name' : 'test2',
'details' : {
'input' : ROOT_DIR + '/app2/static/app2/sass/test2.sass',
'output' : ROOT_DIR + '/app2/static/app2/css/test2.css',
}
},
)

Once all of your Sass files have been defined in your settings.py file, you can now reference
where ROOT_DIR - is a full path to project like /var/www/django

Once all of your Sass files have been defined in your settings.py file, you can now reference
them in your templates.

{% load sass_tag %}
Expand All @@ -52,7 +54,7 @@ the sass file, generating your css.

Management Command
-------------------------------
The 'sassify' command is used to generate the css manually. The css will only be generated if
The 'sassify' command is used to generate the css manually. The css will only be generated if
there are changes made to the sass files.

python manage.py sassify [OPTIONS]
Expand All @@ -66,13 +68,13 @@ Options:

'--list'
- List the status of your named sass entries.

'--clean'
- Remove all generated files.



Compatability
-------------------------------
This library is only compatible with Linux/BSD based distros. I don't use Windows, so if you want
This library is only compatible with Linux/BSD based distros. I don't use Windows, so if you want
Windows support, feel free to submit a patch.
9 changes: 6 additions & 3 deletions sass/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from django.db import models
from django.conf import settings
from django.utils.http import urlquote
from django.templatetags.static import static

SASS_ROOT = getattr(settings, 'SASS_ROOT', settings.MEDIA_ROOT)
SASS_URL = getattr(settings, 'SASS_URL', settings.MEDIA_URL)

# ROOT_DIR - is a full path to project like /var/www/django
SASS_ROOT = getattr(settings, 'SASS_ROOT', settings.ROOT_DIR)
SASS_URL = getattr(settings, 'SASS_URL', settings.STATIC_URL)


class SassModel(models.Model):
Expand All @@ -21,7 +24,7 @@ def relative_css_path(self):
return self.css_path.split(SASS_ROOT)[1].lstrip('/')

def css_media_path(self):
return SASS_URL + urlquote(self.relative_css_path())
return static(self.relative_css_path().split('static/')[-1])


from sass import listeners
Expand Down