mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
build: improve minification, more verbose
This commit is contained in:
parent
84a676403f
commit
b82be022b2
65
build.xml
65
build.xml
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<project name="html2canvas" basedir="." default="build">
|
<project name="html2canvas" basedir="." default="build">
|
||||||
<property name="src.dir" location="src"/>
|
<property name="src.dir" location="src"/>
|
||||||
<property name="lib.dir" location="../lib"/>
|
<property name="lib.dir" location="../lib"/>
|
||||||
@ -11,44 +11,56 @@
|
|||||||
<property name="JQUERY_PLUGIN_NAME" value="jquery.plugin.html2canvas.js"/>
|
<property name="JQUERY_PLUGIN_NAME" value="jquery.plugin.html2canvas.js"/>
|
||||||
<loadfile property="version" srcfile="version.txt" />
|
<loadfile property="version" srcfile="version.txt" />
|
||||||
|
|
||||||
<fileset id="sourcefiles" dir="${src.dir}">
|
<path id="sourcefiles">
|
||||||
<include name="LICENSE"/>
|
<filelist dir="${src.dir}">
|
||||||
<include name="Core.js"/>
|
<file name="LICENSE"/>
|
||||||
<include name="Generate.js"/>
|
<file name="html2canvas-pre.txt"/>
|
||||||
<include name="Parse.js"/>
|
<file name="Core.js"/>
|
||||||
<include name="Preload.js"/>
|
<file name="Generate.js"/>
|
||||||
<include name="Queue.js"/>
|
<file name="Parse.js"/>
|
||||||
<include name="Renderer.js"/>
|
<file name="Preload.js"/>
|
||||||
</fileset>
|
<file name="Queue.js"/>
|
||||||
|
<file name="Renderer.js"/>
|
||||||
|
<file name="Util.js"/>
|
||||||
|
<file name="html2canvas-post.txt"/>
|
||||||
|
</filelist>
|
||||||
|
</path>
|
||||||
|
|
||||||
<path id="jquery-plugin">
|
<path id="jquery-plugin">
|
||||||
<fileset dir="${src.dir}" includes="LICENSE"/>
|
<fileset dir="${src.dir}" includes="LICENSE"/>
|
||||||
<fileset dir="${src.dir}/plugins" includes="${JQUERY_PLUGIN_NAME}"/>
|
<fileset dir="${src.dir}/plugins" includes="${JQUERY_PLUGIN_NAME}"/>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<target name="plugins">
|
<target name="build-dir">
|
||||||
|
<echo>Creating directory ${build.dir}...</echo>
|
||||||
|
<mkdir dir="${build.dir}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="plugins" depends="build-dir">
|
||||||
|
<echo>Creating ${JQUERY_PLUGIN_NAME}...</echo>
|
||||||
<concat fixlastline="yes" destfile="${build.dir}/${JQUERY_PLUGIN_NAME}">
|
<concat fixlastline="yes" destfile="${build.dir}/${JQUERY_PLUGIN_NAME}">
|
||||||
<path refid="jquery-plugin"/>
|
<path refid="jquery-plugin"/>
|
||||||
</concat>
|
</concat>
|
||||||
<replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JQUERY_PLUGIN_NAME}" />
|
<replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JQUERY_PLUGIN_NAME}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<pathconvert property="prettty-sourcefiles" pathsep="${line.separator}" refid="sourcefiles"></pathconvert>
|
||||||
|
|
||||||
<target name="build" depends="plugins">
|
<target name="build" depends="build-dir,plugins">
|
||||||
|
<echo>Concatenating files:${line.separator}${prettty-sourcefiles}${line.separator}into ${build.dir}/${JS_NAME}...</echo>
|
||||||
<concat fixlastline="yes" destfile="${build.dir}/${JS_NAME}">
|
<concat fixlastline="yes" destfile="${build.dir}/${JS_NAME}">
|
||||||
<fileset refid="sourcefiles"/>
|
<path refid="sourcefiles"/>
|
||||||
</concat>
|
</concat>
|
||||||
<replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JS_NAME}" />
|
<replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JS_NAME}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask"
|
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask"
|
||||||
classpath="${lib.dir}/compiler.jar" onerror="report"/>
|
classpath="${lib.dir}/compiler.jar" onerror="report"/>
|
||||||
|
|
||||||
<target name="release" depends="build">
|
<target name="syntaxcheck" depends="build-dir,build">
|
||||||
<jscomp compilationLevel="simple" warning="verbose"
|
<jscomp compilationLevel="simple" warning="verbose"
|
||||||
debug="false"
|
debug="false"
|
||||||
output="${build.dir}/${JS_NAME_MIN}">
|
output="${build.dir}/${JS_NAME_MIN}.tmp">
|
||||||
<externs dir="${lib.dir}">
|
<externs dir="${lib.dir}">
|
||||||
<file name="${jquery-externs}"/>
|
<file name="${jquery-externs}"/>
|
||||||
</externs>
|
</externs>
|
||||||
@ -61,15 +73,28 @@
|
|||||||
<file name="Preload.js"/>
|
<file name="Preload.js"/>
|
||||||
<file name="Queue.js"/>
|
<file name="Queue.js"/>
|
||||||
<file name="Renderer.js"/>
|
<file name="Renderer.js"/>
|
||||||
|
<file name="Util.js"/>
|
||||||
|
</sources>
|
||||||
|
</jscomp>
|
||||||
|
<delete file="${build.dir}/${JS_NAME_MIN}.tmp"></delete>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="release" depends="build-dir,build,syntaxcheck">
|
||||||
|
<jscomp compilationLevel="simple" warning="verbose"
|
||||||
|
debug="false"
|
||||||
|
output="${build.dir}/${JS_NAME_MIN}">
|
||||||
|
<externs dir="${lib.dir}">
|
||||||
|
<file name="${jquery-externs}"/>
|
||||||
|
</externs>
|
||||||
|
<sources dir="${build.dir}">
|
||||||
|
<file name="${JS_NAME}"/>
|
||||||
</sources>
|
</sources>
|
||||||
</jscomp>
|
</jscomp>
|
||||||
<replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JS_NAME_MIN}" />
|
<replaceregexp match="@VERSION@" replace="${version}" flags="g" byline="true" file="${build.dir}/${JS_NAME_MIN}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="clean">
|
<target name="clean">
|
||||||
<delete file="${build.dir}/${JS_NAME}"></delete>
|
<delete dir="${build.dir}"></delete>
|
||||||
<delete file="${build.dir}/${JS_NAME_MIN}"></delete>
|
|
||||||
<delete file="${build.dir}/${JQUERY_PLUGIN_NAME}"></delete>
|
|
||||||
</target>
|
</target>
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
2
src/html2canvas-post.txt
Normal file
2
src/html2canvas-post.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
window.html2canvas = html2canvas;
|
||||||
|
}(window, document));
|
1
src/html2canvas-pre.txt
Normal file
1
src/html2canvas-pre.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
(function(window, document, undefined){
|
@ -8,7 +8,7 @@
|
|||||||
(function(document, window) {
|
(function(document, window) {
|
||||||
var scrStart = '<script type="text/javascript" src="', scrEnd = '"></script>';
|
var scrStart = '<script type="text/javascript" src="', scrEnd = '"></script>';
|
||||||
document.write(scrStart + '../external/jquery-1.6.2.js' + scrEnd);
|
document.write(scrStart + '../external/jquery-1.6.2.js' + scrEnd);
|
||||||
var html2canvas = ['Core', 'Generate', 'Parse', 'Preload', 'Queue', 'Renderer', 'plugins/jquery.plugin.html2canvas'], i;
|
var html2canvas = ['Core', 'Generate', 'Parse', 'Preload', 'Queue', 'Renderer', 'Util', 'plugins/jquery.plugin.html2canvas'], i;
|
||||||
for (i = 0; i < html2canvas.length; ++i) {
|
for (i = 0; i < html2canvas.length; ++i) {
|
||||||
document.write(scrStart + '../src/' + html2canvas[i] + '.js' + scrEnd);
|
document.write(scrStart + '../src/' + html2canvas[i] + '.js' + scrEnd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user