Recently, I decided to try my hand at using batch scripts as a way to compile the .less files for my website into .css files before deploying. It seemed like an efficient solution for my needs.
However, after successfully utilizing a for loop in my batch file to identify and compile all of the .less files into their .css counterparts, I encountered a strange issue. Despite having additional commands following the for loop, the script abruptly stops executing.
Here is a snippet of my batch script:
@echo off
rmdir c:\code\releaseDirectory /s /q
echo d | xcopy /d c:\code\devDirectory c:\code\releaseDirectory /s
cd c:\code\releaseDirectory
for /r %%i in (*.less) do echo %%i
for /r %%i in (*.less) do lessc -x %%i > %%~pi%%~ni.css
echo reached the end of the batch script!
Although the output displays successful compilation of the .less files, the message "reached the end of the batch script!" never appears. Consequently, any post-compilation tasks fail to execute.
What could be causing the script to halt after the less compilation within the for loop? Any insights or suggestions would be greatly appreciated.