如何设置Ant buildscript project.properties文件?

时间:2013-10-22 18:09:37

标签: ant html5boilerplate

您好我在设置Ant BuildScript时遇到问题 当我运行ant时,Java Scripts和CSS不会被压缩,并且样式表链接不会更新为随机数。

在project.properties文件中,我使用以下内容。

file.root.stylesheet    = screen.css
dir.js              = includes/js
dir.js.main         = ${dir.js}
#build.css.scss         = true
dir.css             = css

编译sass已关闭,因为它已由指南针编译 我试图通过将这一行放在js脚本

上来获得单个js文件
<!-- //-beg- concat_js -->
<script src="includes/js/script1.js"></script>
<script src="includes/js/script2.js"></script>
<!-- //-end- concat_js -->

我正在使用的文件夹结构如下:

  • CSS /
  • IMG /
  • 包括/ SASS
    • foundation.scc,screen.scss
  • 包括/ JS
  • 包括/ file.php

我收到以下错误

-js.all.minify:
     [echo] Minifying scripts
     [copy] Copying 4 files to c:\projectfolder\intermediate\includes\js
    [apply] c:\projectfolder\includes\js\plugins.js:86: ERROR - Parse error. IE8 (and below) will parse trailing commas in array and object literals incorrectly. If you are targeting newer
versions of JS, set the appropriate language_in option.
    [apply]                     firstName :  "required",
    [apply]                     ^
    [apply]
    [apply] 1 error(s), 0 warning(s)
    [apply] Result: 1

-js.main.concat:
     [echo] Concatenating Main JS scripts based on index.html...
     [exec] Result: 1
   [concat] c:\projectfolder\intermediate\Exception does not exist.
   [concat] c:\projectfolder\intermediate\in does not exist.
   [concat] c:\projectfolder\intermediate\thread does not exist.
   [concat] c:\projectfolder\intermediate\"main" does not exist.
   [concat] c:\projectfolder\intermediate\java.io.FileNotFoundException: does not exist.
   [concat] c:\projectfolder\intermediate\index.html does not exist.
   [concat] c:\projectfolder\intermediate\(Het does not exist.
   [concat] c:\projectfolder\intermediate\systeem does not exist.
   [concat] c:\projectfolder\intermediate\kan does not exist.
   [concat] c:\projectfolder\intermediate\het does not exist.
   [concat] c:\projectfolder\intermediate\opgegeven does not exist.
   [concat] c:\projectfolder\intermediate\bestand does not exist.
   [concat] c:\projectfolder\intermediate\niet does not exist.
   [concat] c:\projectfolder\intermediate\vinden) does not exist.
   [concat] c:\projectfolder\intermediate\at does not exist.
   [concat] c:\projectfolder\intermediate\java.io.FileInputStream.open(Native does not exist.
   [concat] c:\projectfolder\intermediate\Method) does not exist.
   [concat] c:\projectfolder\intermediate\at does not exist.
   [concat] c:\projectfolder\intermediate\java.io.FileInputStream.<init>(FileInputStream.java:138) does not exist.
   [concat] c:\projectfolder\intermediate\at does not exist.
   [concat] c:\projectfolder\intermediate\java.io.FileInputStream.<init>(FileInputStream.java:97) does not exist.
   [concat] c:\projectfolder\intermediate\at does not exist.
   [concat] c:\projectfolder\intermediate\java.io.FileReader.<init>(FileReader.java:58) does not exist.
   [concat] c:\projectfolder\intermediate\at does not exist.
   [concat] c:\projectfolder\intermediate\FindAttribute.main(Unknown does not exist.
   [concat] c:\projectfolder\intermediate\Source) does not exist.

我已经在我的jsfiddle帐户中放置了一个完整的错误日志 http://jsfiddle.net/piggybattery/bpxBM/1/

有谁知道如何链接到这个结构?

1 个答案:

答案 0 :(得分:0)

修复导致缩小错误的尾随逗号。这只是一个好主意。

除此之外,看起来有大约一百万件事可能出错。使用HTML-Boilerplate结构创建构建脚本非常容易。当你开始添加像PHP,SASS和Foundation这样的东西时,会出现越来越多的问题。它可以处理这些事情,您只需要了解您所做的更改并在构建脚本中反映它们。

要记住的最重要的事情是属性文件中的路径需要指向Ant和Java可以找到的真实文件。

因此,从项目的根目录(构建目录中的一个)确保使用dir.*file.*属性构建的字符串指向磁盘上存在的内容在你的源代码中。因此,例如,如果脚本找不到您的file.root.page(默认情况下它会查找index.html。我猜你的项目中没有index.html?)它可以连接注释中的脚本。另外,如果找不到你的file.root.stylesheet事情会出错(你的主要CSS文件是css/screen.css吗?它是否在你的HTML中被引用?那就是我换掉源代码的地方。)同样的{ {1}}其他问题会出错(将file.root.script设置为file.root.scriptscript1.js吗?同样,这有助于我更改来源)基本上每次从默认HTML5进行更改时您需要在这些属性中反映出Boilderplate结构。