Created
April 29, 2012 15:26
-
-
Save drch-/2551283 to your computer and use it in GitHub Desktop.
Running AjaxMin on sets of files at build time
This file contains hidden or 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
<Target Name="AfterBuild"> | |
<CallTarget Targets="MinifyJs" /> | |
</Target> | |
<PropertyGroup> | |
<AjaxMin>"C:\Program Files (x86)\Microsoft\Microsoft Ajax Minifier\AjaxMin.exe"</AjaxMin> | |
</PropertyGroup> | |
<Target Name="MinifyJs"> | |
<ItemGroup> | |
<File Include="$(MSBuildProjectDirectory)\Scripts\*.minmejs" /> | |
</ItemGroup> | |
<MsBuild Projects="$(MSBuildProjectFile)" Targets="_MinifyJs" Properties="JsMin=%(File.Identity);" Condition=" '%(File.Identity)' != '' " /> | |
</Target> | |
<Target Name="_MinifyJs"> | |
<ItemGroup> | |
<JsFile Include="$(JsMin)" /> | |
</ItemGroup> | |
<ReadLinesFromFile File="$(JsMin)"> | |
<Output TaskParameter="Lines" ItemName="FileContents" /> | |
</ReadLinesFromFile> | |
<Exec Command="$(AjaxMin) @(FileContents->'%(Identity)', ' ') -out %(JsFile.Filename).min.js -clobber" WorkingDirectory="%(JsFile.RootDir)%(JsFile.Directory)" /> | |
</Target> |
This file contains hidden or 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
# one js filename per line to be minified/combined. file will be renamed from xxx.minmejs to xxx.min.js | |
script.js | |
lib/external-library.js | |
util.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment