from compress.conf import settings
from compress.compilers import CompilerBase


class LessCompiler(CompilerBase):
    def match_file(self, filename):
        return filename.endswith('.less')

    def compile_file(self, content):
        tmp_file = tempfile.NamedTemporaryFile(mode='w+b')
        tmp_file.write(css)
        tmp_file.flush()

        output_file = tempfile.NamedTemporaryFile(mode='w+b')

        command = '%s %s %s %s' % (
            settings.COMPRESS_LESS_BINARY, tmp_file.name,
            settings.COMPRESS_LESS_ARGUMENTS, output_file.name
        )

        command_output = os.popen(command).read()

        compiled_content = output_file.read()
        output_file.close()
        tmp_file.close()

        if self.verbose:
            print command_output
        return compiled_content

import os
import tempfile

from compress.conf import settings
from compress.compilers import CompilerBase


class LessCompiler(CompilerBase):
    def match_file(self, filename):
        return filename.endswith('.less')

    def compile_file(self, content):
        tmp_file = tempfile.NamedTemporaryFile(mode='w+b')
        tmp_file.write(content)
        tmp_file.flush()

        output_file = tempfile.NamedTemporaryFile(mode='w+b')

        command = '%s %s %s %s' % (
            settings.COMPRESS_LESS_BINARY, tmp_file.name,
            settings.COMPRESS_LESS_ARGUMENTS, output_file.name
        )

        command_output = os.popen(command).read()

        compiled_content = output_file.read()
        output_file.close()
        tmp_file.close()

        if self.verbose:
            print command_output
        return compiled_content

make less compiler work