Running Nodejs' Lessc from Cygwin throws error with absolute path

88 views Asked by At

I have Windows 10 (64 bits), Cygwin, Nodejs installed via Windows Installer and lessc installed on top of Nodejs.

I am trying to make django-compressor work with precompilers as suggested in documentation:

COMPRESS_PRECOMPILERS = (
    #...
    ('text/less', 'lessc {infile} {outfile}'),
    #...
)

It throws

lessc: ENOENT: no such file or directory, open 'C:\awkwardly\converted\cygwin\path\to\my\file.less' (Notice the drive letter added)

I tested the command lessc from the Cygwin console. It works fine as long as I use relative paths, but when I use an absolute path it converts it to Windows path, even prepending a drive letter, something like

C:\cygdrive\d\projects\my\path\to\file.less

How can I fix/workaround this?

1

There are 1 answers

0
Lorenzo Peña On BEST ANSWER

So far, the option is using cygpath to feed lessc with an appropriate windows path, like this:

COMPRESS_PRECOMPILERS = (
    #...
    ('text/less', 'lessc $(cygpath -w {infile}) > {outfile}'),
    #...
)

Also, output must be redirected to {outfile} and not passing {outfile} as parameter.