Last active
December 19, 2015 23:29
-
-
Save jorilallo/6035248 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| COMPRESS_PRECOMPILERS = ( | |
| ('text/coffeescript', 'coffee --compile --stdio'), | |
| ('text/x-scss', 'python manage.py template_filter {infile} | sass --scss --stdin {outfile}'), | |
| ) | |
| COMPRESS_CSS_FILTERS = ['compressor.filters.cssmin.CSSMinFilter'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.core.management.base import BaseCommand, CommandError | |
| from django.contrib.staticfiles import finders | |
| from django.template import Template, Context | |
| from django.conf import settings | |
| class Command(BaseCommand): | |
| args = '<input_file.scss>' | |
| def handle(self, *args, **options): | |
| if len(args) != 1: | |
| raise CommandError('Give filename as argument') | |
| filename = args[0] | |
| template = Template(open(finders.find(filename)).read()) | |
| context = Context(settings.COMPRESS_TEMPLATE_FILTER_CONTEXT) | |
| data = template.render(context) | |
| self.stdout.write(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment