Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to compile less file using php, and I am trying to use lessc which I installed as nodejs module on my windows 7

I am trying to do :

$command = lessc %s -compress %s 

via

exec($command, $output);

and if I do this via cmd it works fine but I can't execute it using above command in php :(.

the path which works are relative to my drive (E:/wamp/my-project/less/hello.less)

Any body knows what I am doing wrong?

Note: I know how I can use lessphp compiler, and I am already using it but I would like to use lessc module installed via nodejs.

share|improve this question

1 Answer 1

Are you able to get the output of the command when it fails? It's possible that lessc isn't directly available in your path. If you installed it via npm install -g then it will likely be in %appdata%, which is a user path'd directory. It really depends upon how the php process gets initiated, but my guess is that this path won't work.

If I need to use an npm module like this, I usually npm install it locally, and invoke the path to lessc.cmd from a relative path to my program.

Hope this helps. Happy coding!

share|improve this answer
    
Thanks Justin, I haven't digged it again yet, will give it another go in coming weeks, as I am starting to have issues with lessphp (its not a clone of less.js, so :(). Will let you know if it works or not. –  Syed Nov 8 '13 at 13:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.