亲爱的大家, 我需要使用 Shrinksafe 将一个文件夹内的所有 JavaScript 文件合并到一个文件中。 我正在使用以下 ANT 脚本。但这并不能正常工作。
<!-- Merge the JS files in scripts folder to a single file-->
<target name="mergegp-js">
<echo message="Starting Merging"/>
<java fork="true" dir="${shrinksafe.util.path}/buildscripts" classname="org.mozilla.javascript.tools.shell.Main">
<classpath>
<pathelement location="${shrinksafe.util.path}/shrinksafe/js.jar"/>
<pathelement location="${shrinksafe.util.path}/shrinksafe/shrinksafe.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
<arg value="build.js"/>
<arg value="${merged.gpstatic.folder}/test/scripts/*.js > tempMerged.js"/>
</java>
<echo message="js build successfull." />
</target>
但是上面的脚本给了我以下错误。
[java] js: "jslib/buildUtil.js", line 1168: exception from uncaught JavaScript throw: Malformed name/value pair: [C:/Test/scripts/*.js]. Format should be name=value
有人可以指导我解决这个问题吗?
最佳答案
build.js
的参数应采用 name=value
格式。例如,profile=standard action=release
。您需要更改参数的语法以匹配格式。所以
<arg value="build.js"/>
应该是这样的:
<arg value="profile=standard action=release" />
关于javascript - 使用 Shrinksafe 合并 JS 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5456760/