【发布时间】:2011-11-20 19:47:16
【问题描述】:
我有几个 HTML 文件位于不同的位置(在一个共同的根目录中),如下所示:
index.html
moduleA/list.html
moduleA/add.html
moduleB/list.html
moduleB/add.html
...
此外,我还有一个名为 _template.html 的文件,其中包含 HTML 代码和占位符 #CONTENT#。
我需要什么:
- 将所有 HTML 文件复制到 public/ 目录
- public/ 目录中的每个 HTML 文件还应该包含来自 _template.html 的代码,包裹在原始内容周围。
我使用 ANT 来复制文件,但我不知道如何将模板代码包装在代码周围... 我的 ANT 脚本如下所示:
<project default="build">
<target name="build">
<copy todir="${dir.intermediate}/temp">
<fileset dir="${dir.source}" includes="**/*.html"/>
</copy>
</target>
</project>
示例:
index.html
<div>This is the index-page</div>
_template.html
<html>
<head><title>Page-Title</title></head>
<body>
#CONTENT#
</body>
</html>
应该生成输出文件:
<html>
<head><title>Page-Title</title></head>
<body>
<div>This is the index-page</div>
</body>
</html>
【问题讨论】:
标签: ant build-automation