I am trying to automate a process using the windows command line. Part of this automation is compiling a couple of files from .less to .css. I have successfully installed node.js and the LESS compiler using the npm.
I have a Command Prompt Script (.cmd) which contains the folowing commands:
echo Compiling CSS...
pause
lessc -x C:\path_to_file\file1.less > ..\output\file1.css
pause
lessc -x C:\path_to_file\file2.less > ..\output\file2.css
pause
The first lessc command works without any compile errors, and saves file1.css to the output folder as expected.
The command line then quits without even hitting the second pause command, let along asking for user input.
I don't understand why the command prompt is quitting. Does anyone have any ideas?
Thanks.
As seven-phases-max stated, less is a command line script in windows and does not return back to the original script.
The work-around is to use call. The script ended up being:
echo Compiling CSS...
pause
call lessc -x C:\path_to_file\file1.less ..\output\file1.css
pause
call lessc -x C:\path_to_file\file2.less ..\output\file2.css
pause
All credit goes to seven-phases-max, i just wanted to clarify the correct method as it may help others in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With