如何让它自动在我的所有文件上运行?适用于 Visual Studio 的 YUI 压缩器
编辑 4(编辑 1 到 3 已解决,已删除)
我的最后一个问题是我想要多个目标,但它似乎不起作用。我必须将它们全部粘贴到同一个目标中,这有点糟糕,因为它会很好地使用不同的名称,所以我必须更改一些我可以只查看目标名称的东西。
您好,
我正在尝试获取我的 MsBuild,它可以工作......如果我的所有内容都在同一个目标标签中。如果我有多个标签,它只会执行第一个标签,仅此而已。其他目标都没有完成。
<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>
所以上面的方法有效。如果我这样做,
<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>
那么第一个目标将会消失,而上面的目标将不会执行任何操作。
Edit 4 (Edit 1 to 3 removed as they where solved)
My last problem is that I would like multiple targets but it does not seem to work. I have to stick them all into the same target what kinda sucks since it would nice to different names so I got to change something I can just look at the target name.
Hi
I am trying to get my MsBuild and it works....if all my stuff is in the same target tag. If I have multiple tags it only does the first one and that's it. None of the other targets are done.
<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 one will do nothing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看起来这是一个很好的起点:
http://yuicompressor.codeplex.com/
他们吹嘘:
Looks like this is a good place to start:
http://yuicompressor.codeplex.com/
They boast:
我不确定,但看起来 MSBuild 变量访问存在一些混乱。使用 msbuild 可以通过三种方式访问变量。
看起来您实际上想在使用
%()
的地方使用@()
但我承认我很难准确理解您的问题是。你说它“什么也不做”,但它很可能正在做某事,即使它看起来什么也没做。更多信息
I'm not sure, but it looks like there is some confusion about MSBuild variable access. There are three ways to access variables with msbuild.
It looks like you actually want to be using
@()
where you are using%()
but I'll confess I'm having a hard time understanding exactly what your problem is. You said it "will do nothing" but chances are it's doing something, even if it doesn't appear to be doing anything.more here
您应该能够通过修改项目的 .proj 文件中的 msbuild 脚本来完成此操作。
以下是 MsBuild 的链接 -
http://msdn.microsoft.com/ en-us/library/0k6kkbsd.aspx
享受吧!
You should be able to do this by modifying the msbuild script in the .proj file of your project.
Here is a link to MsBuild --
http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx
Enjoy!