Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dotless: how to process a list of LESS files using dotless.Compiler.exe

I wanted to know how to process a list of LESS files using the exe binaries, for example:

./dotless.Compiler.exe -m *.less

Right now I only can do individual files, but can't do wildcard.

The reason why I asked about this is that I want to create a target in MSBuild, which is to process an item collection (which is a list of files). I couldn't find a way to loop a task in side MSBuild. If anyone knows how to loop a task for each file, that would solve my problem too.

like image 579
Grace Shao Avatar asked Feb 24 '23 13:02

Grace Shao


1 Answers

Use an ItemGroup to get a list of files like this:

<ItemGroup>
    <MyFiles Include="[path to less files]\*" />
</ItemGroup>

Call the compiler once for each file by using %(MyFiles.FullPath) syntax (also known as Task Batching)

<Target Name="CompileLess">
   <Exec Command="$(dotLessCompiler) -m %(MyFiles.FullPath)" />
</Target>
like image 159
Mrchief Avatar answered Feb 26 '23 21:02

Mrchief