IIssNan's Notes

Quick notes


  • 首页

  • 归档

  • 标签

  • 搜索

Apache Ant

发表于 2011-08-24 | | 阅读次数

Apache Ant

[2011-08-24] OSX comes with ant

[2011-08-27] 一份简单的构建文件(build.xml)

1
2
3
4
5
6
<?xml version="1.0" ?>
<project name="ant-hello-world" default="init" basedir=".">
<target name="init">
<echo>Hello World!</echo>
</target>
<project>

[2011-09-15]合并文件 - Task concat

1
2
3
4
5
6
7
8
<target name="js-concat">
<concat destfile="${web.dir}/js/script.js" encoding="UTF-8">
<header trimleading="yes">(function(){ </header>
<filelist dir="${web.dir}/js"
files="jquery.js, form.js, animate.js, analytics.js" />
<footer>})();</footer>
</concat>
</target>

[2011-09-15]JsLint (Jslint4java)

1
2
3
4
5
6
7
8
9
10
11
<!--JSLint-->
<taskdef name="jslint"
classname="com.googlecode.jslint4java.ant.JSLintTask"
classpath="${lib.dir}/jslint4java-2.0.0.jar" />
<target name="js-lint">
<jslint>
<formatter type="plain" />
<fileset dir="${web.dir}/js"
includes="form.js, animate.js" />
</jslint>
</target>

[2011-09-16]Compress JS Using Google Compiler Closure

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!--Compress JS Using Google Compiler Closure-->
<target name="JS-Compress">
<property name="google.compressor" value="${lib.dir}/compiler.jar" />
<apply executable="java" dest="${web.dir}/js">
<fileset dir="${web.dir}/js" includes="think.js" />
<arg line="-jar" />
<arg path="${google.compressor}" />
<arg line="--js" />
<srcfile />
<arg line="--js_output_file" />
<mapper type="glob" from="*.js" to="*-min.js" />
<targetfile />
</apply>
</target>

What happened to console.log in IE8

发表于 2011-08-21 | | 阅读次数

在Internet Explorer 8中,如果没有打开Developer Toolbar,那么代码中调用console.log将会提示错误。一种避免方法是判断console以及console.log是否存在,若不存在则调用alert方法:

1
2
3
4
5
6
7
function trace(s) {
if (this.console && typeof console.log !== "undefined") {
console.log(s);
} else {
alert(s);
}
}

用try..catch简写为:

1
2
3
function trace(s) {
try { console.log(s) } catch (e) { alert(s) }
}

参考资料:

  • What happened to console.log in IE8? - Stack Overflow

Hello, WordPress from Magician UIc's hat

发表于 2011-08-19 | | 阅读次数

欢迎使用 WordPress。这是系统自动生成的演示文章。编辑或者删除它,然后开始您的博客!

1…3637
IIssNan

IIssNan

胡编一通,乱写一气

183 日志
6 分类
111 标签
RSS
GitHub Twitter 豆瓣 知乎
© 2011 - 2017 IIssNan
由 Hexo 强力驱动
主题 - NexT.Pisces
0%