Skip to content

Commit af582b9

Browse files
committed
Build: Cleanup and adding CSS minimization. Fixes #5824 - Minify CSS
1 parent 25853be commit af582b9

File tree

2 files changed

+37
-18
lines changed

2 files changed

+37
-18
lines changed

build/build.xml

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@
4040
<property name="core.files.min" value="jquery.ui.core.min.js, jquery.ui.widget.min.js, jquery.ui.mouse.min.js, jquery.ui.draggable.min.js, jquery.ui.droppable.min.js, jquery.ui.resizable.min.js, jquery.ui.selectable.min.js, jquery.ui.sortable.min.js, jquery.effects.core.min.js" />
4141

4242
<property description="Google Closure" name="closure-jar" value="${build.dir}/google-compiler-20091218.jar" />
43+
<property description="YUI Compressor" name="yuicompressor-jar" value="${build.dir}/yuicompressor-2.4.2.jar" />
4344

44-
<target name="deploy-release" depends="clean, docs-download, concatenate, minify, copy, replace-version, prepend-header, zip" description="Release builder">
45+
<target name="deploy-release" depends="clean, docs-download, copy, minify, replace-version, prepend-header, zip" description="Release builder">
4546
</target>
4647

4748
<target name="replace-version">
@@ -74,6 +75,26 @@
7475
<fileset dir="${dist.dir}/ui-headered/" includes="*.js" />
7576
</copy>
7677

78+
<copy todir="${dist.dir}/headers/">
79+
<fileset dir="${dist.dir}/themes/base" includes="*.css" />
80+
</copy>
81+
<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
82+
<fileset dir="${dist.dir}/headers/" includes="*.css"/>
83+
</replaceregexp>
84+
<for param="file">
85+
<path><fileset dir="${dist.dir}/themes/base/minified" includes="*.css" /></path>
86+
<sequential>
87+
<propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.css$" replace="\1"/>
88+
<concat destfile="${dist.dir}/ui-headered/${target}.min.css">
89+
<header file="${dist.dir}/headers/${target}.css" />
90+
<fileset file="@{file}" />
91+
</concat>
92+
</sequential>
93+
</for>
94+
<copy todir="${dist.dir}/themes/base/minified" overwrite="true">
95+
<fileset dir="${dist.dir}/ui-headered/" includes="*.css" />
96+
</copy>
97+
7798
<!-- once more for the i18n files -->
7899
<!-- need to clean up headers in those files first
79100
<copy todir="${dist.dir}/headers/i18n/">
@@ -136,13 +157,12 @@
136157

137158
<target name="minify" depends="concatenate" description="Remove all comments and whitespace, no compression, great in combination with GZip">
138159
<echo message="Building minified" />
139-
<delete dir="${min.dir}/" />
140160
<mkdir dir="${min.dir}" />
141-
<delete dir="${min.dir}/i18n/" />
142161
<mkdir dir="${min.dir}/i18n/" />
162+
<mkdir dir="${dist.dir}/themes/base/minified" />
143163

144164
<apply executable="java" parallel="false">
145-
<fileset dir="${src.dir}/" includes="jquery.ui.*.js, jquery.effects.*.js" />
165+
<fileset dir="${dist.dir}/ui" includes="*.js" />
146166
<arg line="-jar" />
147167
<arg path="${closure-jar}" />
148168
<arg value="--warning_level" />
@@ -153,13 +173,8 @@
153173
<mapper type="glob" from="*.js" to="${min.dir}/*.min.js" />
154174
</apply>
155175

156-
<concat destfile="${min.dir}/${concatenated}.min.js">
157-
<filelist dir="${min.dir}" files="${core.files.min}" />
158-
<fileset dir="${min.dir}" includes="jquery.ui.*.js, jquery.effects.*.js" excludes="${core.files.min}" />
159-
</concat>
160-
161176
<apply executable="java" parallel="false">
162-
<fileset dir="${src.dir}/i18n/" includes="jquery.ui.*.js" />
177+
<fileset dir="${dist.dir}/ui/i18n" includes="*.js" />
163178
<arg line="-jar" />
164179
<arg path="${closure-jar}" />
165180
<arg value="--warning_level" />
@@ -170,9 +185,17 @@
170185
<mapper type="glob" from="*.js" to="${min.dir}/i18n/*.min.js" />
171186
</apply>
172187

173-
<concat destfile="${min.dir}/i18n/${concatenated.i18n}.min.js">
174-
<fileset dir="${min.dir}/i18n" includes="jquery.ui.*.js" />
175-
</concat>
188+
<apply executable="java" parallel="false">
189+
<fileset dir="${dist.dir}/themes/base" includes="*.css" />
190+
<arg line="-jar" />
191+
<arg path="${yuicompressor-jar}" />
192+
<arg line="--charset utf-8" />
193+
<arg line="-v" />
194+
<srcfile />
195+
<arg line="-o" />
196+
<mapper type="glob" from="*.css" to="${dist.dir}/themes/base/minified/*.min.css" />
197+
<targetfile/>
198+
</apply>
176199

177200
<echo message="Minified ui/ built." />
178201
</target>
@@ -219,7 +242,7 @@
219242
<delete dir="dist" />
220243
</target>
221244

222-
<target name="docs-download" depends="docs-clean">
245+
<target name="docs-download">
223246
<mkdir dir="${docs.dir}" />
224247
<property name="url" value="http://docs.jquery.com/action/render/UI/API/${release.version}/" />
225248

@@ -269,10 +292,6 @@
269292
<get src="http://docs.jquery.com/action/render/UI/Effects/Transfer" dest="${docs.dir}effect-transfer.html" />
270293
</target>
271294

272-
<target name="docs-clean">
273-
<delete dir="${docs.dir}" />
274-
</target>
275-
276295
<target name="themes-download">
277296
<!-- to create/update query strings for the theme-file, execute this in Firebug on /download page:
278297
$("select option[value!=none]").map(function() { $(this).parent().val(this.value).change(); return $(this).parents("form").serialize(); }).get().join(",");

build/build/yuicompressor-2.4.2.jar

831 KB
Binary file not shown.

0 commit comments

Comments
 (0)