How can I make this launch for all my files automatically? YUI Compressor for Visual Studios
Edit 4 (edit from 1 to 3 as they were solved)
My last problem is that I need multiple targets, but it doesn't work. I have to keep them all for the same target, which sucks as it would be fine for different names, so I needed to change something that I can just look at the target name.
Hello
I am trying to get MsBuild and it works ... if all my stuff is in the same target tag. If I have multiple tags, then only the first and that one. None of the other goals have been met.
<Target Name="Test1">
<ItemGroup>
<JavaScriptFiles Remove="@(JavaScriptFiles)" />
<JavaScriptFiles Include="..\PathHere\Javascript.js"/>
</ItemGroup>
<CompressorTask
JavaScriptFiles="%(JavaScriptFiles.Identity)"
ObfuscateJavaScript="True"
PreserveAllSemicolons="False"
DisableOptimizations="Nope"
EncodingType="Default"
DeleteJavaScriptFiles="false"
LineBreakPosition="-1"
JavaScriptOutputFile="../Path/Here/(JavaScriptFiles.FileName).min.js"
LoggingType="ALittleBit"
ThreadCulture="en-au"
IsEvalIgnored="false"
/>
<ItemGroup>
<JavaScriptFiles Remove="@(JavaScriptFiles)" />
<JavaScriptFiles Include="..\PathHere\Javascript2.js"/>
</ItemGroup>
<CompressorTask
JavaScriptFiles="%(JavaScriptFiles.Identity)"
ObfuscateJavaScript="True"
PreserveAllSemicolons="False"
DisableOptimizations="Nope"
EncodingType="Default"
DeleteJavaScriptFiles="false"
LineBreakPosition="-1"
JavaScriptOutputFile="../Path/Here/%(JavaScriptFiles.FileName).min.js"
LoggingType="ALittleBit"
ThreadCulture="en-au"
IsEvalIgnored="false"
/>
</Target>
So the above works. If i do this
<Target Name="Test2">
<ItemGroup>
<JavaScriptFiles Remove="@(JavaScriptFiles)" />
JavaScriptFiles Include="..\PathHere\Javascript3.js"/>
</ItemGroup>
<CompressorTask
JavaScriptFiles="%(JavaScriptFiles.Identity)"
ObfuscateJavaScript="True"
PreserveAllSemicolons="False"
DisableOptimizations="Nope"
EncodingType="Default"
DeleteJavaScriptFiles="false"
LineBreakPosition="-1"
JavaScriptOutputFile="../Path/Here/%(JavaScriptFiles.FileName).min.js"
LoggingType="ALittleBit"
ThreadCulture="en-au"
IsEvalIgnored="false"
/>
</Target>
Then the first target will go and the above will do nothing.
a source to share
I'm not sure, but it looks like there is some confusion about how the MSBuild variable is accessed. There are three ways to access variables with msbuild.
$() Extracts the value of a property
@() Extracts the value of an item as a list, that is, vector
%() Extracts value of an item as a single string, that is, scalar
It sounds like you really want to use @()
where you are using %()
, but I confess I am having a hard time figuring out what your problem is. You said that he "won't do anything," but most likely he is doing something, even if he is not doing anything.
a source to share
This looks like a good place to start:
http://yuicompressor.codeplex.com/
They boast:
Integration of events after Visual Studio build! :) (with detailed instructions ...
a source to share
You should do this by modifying the msbuild script file in your project's .proj file.
Here is a link to MsBuild -
http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx
Enjoy!
a source to share