1

I have django-pipeline installed and am using it to compile a LESS file into a css file. Most of the time, when I run collectstatic, it works as expected:

  • stylesheet.less -> stylesheet.css -> stylesheet.min.css

However, if the LESS file has syntax errors, django-pipeline will just ignore it and use the old version of stylesheet.css without telling me:

  • stylesheet.less quietly discarded
  • stylesheet.css -> stylesheet.min.css

Deleting the stylesheet.css file will force django-pipeline to let me know when there are errors but I would prefer if it just told me instead. Is there a setting to force django-pipeline to tell me when I have syntax errors or is this just a bug/lack-of-feature?

My setup is pretty simple. Here are the relevant settings:

STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
PIPELINE = True
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yui.YUICompressor'
PIPELINE_LESS_BINARY = '/usr/bin/lessc'
PIPELINE_COMPILERS = (
    'pipeline.compilers.less.LessCompiler',
    )
PIPELINE_CSS = {
    'min' : {
        'source_filenames': (
            'scripts/stylesheet.less',
            ),
        'output_filename': 'scripts/stylesheet.min.css'
        },
    }
Bass Jobsen
  • 48,736
  • 16
  • 143
  • 224
scottmrogowski
  • 2,063
  • 4
  • 23
  • 32

1 Answers1

1

As far as i understand only send two signals, see: http://django-pipeline.readthedocs.org/en/1.3.16/signals.html. one after processing the CSS and one after processing the Javascript.

You could try to add a failure signal in your pipeline/compilers/less.py:

 less_failure = django.dispatch.Signal()
 CSScode = self.execute_command(command, cwd=dirname(infile))
 if "Error:" in CSScode: less_failure.send(sender=self.__class__);
 return CSScode;

More about signals can be found at: https://docs.djangoproject.com/en/dev/topics/signals/

Bass Jobsen
  • 48,736
  • 16
  • 143
  • 224