0
我需要使用Shrinksafe将多个JavaScript文件(在特定文件夹中)压缩和合并到单个文件。我可以使用下面的命令将文件合并到一个文件中。使用Shrinksafe压缩和合并多个JS文件
java -jar shrinksafe.jar *.js > testMin.js
的问题,这是一个,它不会把所有的脚本一行。它只是删除评论。
另外我需要使用ant构建脚本来完成相同的任务。
我尝试下面的方法
<target name="compress-js">
<echo message="Starting JS compress Build"/>
<java fork="true" dir="${shrinksafe.util.path}/buildscripts" classname="org.mozilla.javascript.tools.shell.Main">
<arg value="build.js"/>
<arg line="releaseDir=../../../../../../StaticFiles/acb profile=acb_js action=clean,release *.js > acb.js" />
<classpath>
<pathelement location="${shrinksafe.util.path}/shrinksafe/js.jar"/>
<pathelement location="${shrinksafe.util.path}/shrinksafe/shrinksafe.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
<echo message="js build successfull." />
</target>
我不知道我是否可以使用上面的脚本达到我的要求。这是我正在使用的dojo配置文件。
//Below code is from acb-js.profile.js file.
dependencies = {
layers: [
{
name: "../gp-js.js",
resourceName:"gp-js",
dependencies: [
]
}
],
prefixes: [
["scripts", "../../scripts"]
]
};
我的JavaScript文件位于StaticFiles/acb/homepage
文件夹内。
请帮助我。提前感谢。任何帮助将不胜感激。