Nant foreach 包括排除过滤器未按预期工作
我希望从 nant (0.91) 目标中排除特定文件并处理其余部分。
这是代码片段,显示我想要包含所有 .js 文件但排除 foo。 foo 并未被排除在外。我尝试将排除放在包含之前,但结果相同。
<foreach item="File" in="${built.web.directory}\Content\js" property="filename">
<in>
<items basedir="${built.web.directory}\Content\js">
<include name="/**/*.js" />
<exclude name="**/foo.1.2.js" />
</items>
</in>
<do>
<echo message="Compressing ${filename}" />
<exec
program="${packer.exe}"
commandline="-o ${built.web.directory}\Content\js\${path::get-file-name(filename)} -m jsmin ${filename}"
/>
</do>
</foreach>
I wish to exclude particular files from a nant (0.91) target and process the remainder.
Here's the code snippet, which shows I want to include all .js files but exclude foo.
foo is not being excluded. I've tried putting the exclude before the include but same result.
<foreach item="File" in="${built.web.directory}\Content\js" property="filename">
<in>
<items basedir="${built.web.directory}\Content\js">
<include name="/**/*.js" />
<exclude name="**/foo.1.2.js" />
</items>
</in>
<do>
<echo message="Compressing ${filename}" />
<exec
program="${packer.exe}"
commandline="-o ${built.web.directory}\Content\js\${path::get-file-name(filename)} -m jsmin ${filename}"
/>
</do>
</foreach>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您已在 foreach 上指定了 in 属性,该属性将覆盖 items 元素。尝试将:更改
为:
You have specified the in attribute on foreach which is overriding the items element. Try changing:
to:
这似乎有效:
This seems to work: