jezdez/django_compressor — Issue #147: less being filtered, but not being put into cached files.
Author: jamiecurle
Created: 2011-11-03 11:15:33+00:00
State: open

I was scratching my head for a few hours trying to get my less file to be filtered by compress and I simply couldn't get it to work.

I had the following in my settings.py

COMPRESS_PRECOMPILERS = (
('text/less', '/usr/bin/lessc {infile} {outfile}'),
)

COMPRESS_ENABLED = True

and in my html I had

Less was working correctly locally, but compressor wasn't putting the filtered CSS into the cached files.

After digging around in the source I found this around line 140 of filters/base.py

finally:
if self.infile is not None:
self.infile.close()
if self.outfile is not None:
filtered = self.outfile.read()
self.outfile.close()

if I commented out the line where filtered is being assigned to self.outfile.read() everything worked as expected and the parsed less was being correctly placed into the cached files.