-
-
Save javafun/b04fc458aa97717db77d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Usage: | |
1. Download this file into your project folder, named it as "Less.targets" | |
2. Use notepad to open your project file (e.g. Example.csproj), and put following code to above of end element 'Project'. | |
<Import Project="Less.targets" /> | |
3. Change element type of *.less file in your project file to "LessCompile". | |
You need to do that manual first time. After that, you can change the file's "build action" to 'LessCompile' through PropertyGrid. | |
4. Close notepad and reload your project in VisualStudio. Then press F6 to build your project. | |
You will found the css file will be generated by build process automatically. | |
--> | |
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<CompileDependsOn> | |
CompileLess; | |
$(CompileDependsOn); | |
</CompileDependsOn> | |
</PropertyGroup> | |
<PropertyGroup> | |
<LessBuildConfigurations>--no-color</LessBuildConfigurations> | |
</PropertyGroup> | |
<ItemGroup> | |
<LessCompileArgs Include="@(LessCompile -> '"%(fullpath)" "%(rootdir)%(directory)%(filename).css"')" /> | |
</ItemGroup> | |
<Target Name="CompileLess"> | |
<Message Text="Compiling Less files" /> | |
<Message Text="Executing lessc $(LessBuildConfigurations) %(LessCompileArgs.Identity)" /> | |
<Exec Command=""$(APPDATA)\npm\lessc.cmd" $(LessBuildConfigurations) %(LessCompileArgs.Identity)" /> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment