Made the CSSTidyFilter function.
Signed-off-by: Jannis Leidel <jannis@leidel.info>
This commit is contained in:
committed by
Jannis Leidel
parent
7255025f11
commit
9e148cdd90
1
AUTHORS
1
AUTHORS
@@ -3,6 +3,7 @@ Christian Metts
|
||||
Django Compressor's filters started life as the filters from Andreas Pelme's
|
||||
django-compress.
|
||||
|
||||
Aaron Godfrey
|
||||
Atamert Ölçgen
|
||||
Ben Spaulding
|
||||
Brad Whittington
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import os
|
||||
import warnings
|
||||
from subprocess import Popen, PIPE
|
||||
import tempfile
|
||||
import warnings
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
@@ -18,16 +18,17 @@ class CSSTidyFilter(FilterBase):
|
||||
tmp_file.flush()
|
||||
|
||||
output_file = tempfile.NamedTemporaryFile(mode='w+b')
|
||||
|
||||
|
||||
command = '%s %s %s %s' % (BINARY, tmp_file.name, ARGUMENTS, output_file.name)
|
||||
|
||||
command_output = os.popen(command).read()
|
||||
|
||||
|
||||
command_output = Popen(command, shell=True,
|
||||
stdout=PIPE, stdin=PIPE, stderr=PIPE).communicate()
|
||||
|
||||
filtered_css = output_file.read()
|
||||
output_file.close()
|
||||
tmp_file.close()
|
||||
|
||||
|
||||
if self.verbose:
|
||||
print command_output
|
||||
|
||||
|
||||
return filtered_css
|
||||
|
||||
Reference in New Issue
Block a user