html5-starter 0.1.4b → 0.1.8b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. data/README.md +11 -113
  2. data/stylesheets/html5-boilerplate/_fonts.scss +4 -4
  3. data/stylesheets/html5-boilerplate/_handheld.scss +3 -3
  4. data/stylesheets/html5-boilerplate/_helpers.scss +14 -7
  5. data/stylesheets/html5-boilerplate/_print.scss +2 -2
  6. data/stylesheets/html5-boilerplate/_reset.scss +8 -8
  7. data/stylesheets/html5-boilerplate/_styles.scss +16 -31
  8. data/templates/project/files/404.html +37 -21
  9. data/templates/project/files/apple-touch-icon-114x114-precomposed.png +0 -0
  10. data/templates/project/files/apple-touch-icon-57x57-precomposed.png +0 -0
  11. data/templates/project/files/apple-touch-icon-72x72-precomposed.png +0 -0
  12. data/templates/project/files/apple-touch-icon-precomposed.png +0 -0
  13. data/templates/project/files/apple-touch-icon.png +0 -0
  14. data/templates/project/files/build/build.xml +813 -628
  15. data/templates/project/files/build/config/buildinfo.properties +5 -0
  16. data/templates/project/files/build/config/default.properties +22 -21
  17. data/templates/project/files/build/config/project.properties +9 -8
  18. data/templates/project/files/build/createproject.sh +29 -52
  19. data/templates/project/files/build/runbuildscript.bat +5 -0
  20. data/templates/project/files/build/tools/htmlcompressor-1.1.jar +0 -0
  21. data/templates/project/files/build/tools/{yuicompressor-2.4.2.jar → yuicompressor-2.4.5.jar} +0 -0
  22. data/templates/project/files/gitignore.txt +6 -0
  23. data/templates/project/files/htaccess +71 -8
  24. data/templates/project/index.html +30 -31
  25. data/templates/project/javascripts/libs/dd_belatedpng.js +1 -1
  26. data/templates/project/javascripts/libs/{jquery-1.5.0.js → jquery-1.5.1.js} +549 -409
  27. data/templates/project/javascripts/libs/jquery-1.5.1.min.js +16 -0
  28. data/templates/project/javascripts/libs/modernizr-1.7.min.js +2 -0
  29. data/templates/project/javascripts/plugins.js +3 -1
  30. data/templates/project/manifest.rb +22 -59
  31. data/templates/project/style.scss +17 -0
  32. metadata +15 -44
  33. data/templates/project/files/build/config/build.properties +0 -3
  34. data/templates/project/files/build/tools/css-compressor/CSSCompression.php +0 -465
  35. data/templates/project/files/build/tools/css-compressor/changelog.txt +0 -22
  36. data/templates/project/files/build/tools/css-compressor/cli.php +0 -101
  37. data/templates/project/files/build/tools/css-compressor/helpers/hex2short-colors.json +0 -39
  38. data/templates/project/files/build/tools/css-compressor/helpers/hex2short-safe.json +0 -16
  39. data/templates/project/files/build/tools/css-compressor/helpers/long2hex-colors.json +0 -127
  40. data/templates/project/files/build/tools/css-compressor/lib/Cleanup.php +0 -218
  41. data/templates/project/files/build/tools/css-compressor/lib/Color.php +0 -199
  42. data/templates/project/files/build/tools/css-compressor/lib/Combine/Aural.php +0 -109
  43. data/templates/project/files/build/tools/css-compressor/lib/Combine/Background.php +0 -107
  44. data/templates/project/files/build/tools/css-compressor/lib/Combine/Border.php +0 -98
  45. data/templates/project/files/build/tools/css-compressor/lib/Combine/BorderOutline.php +0 -109
  46. data/templates/project/files/build/tools/css-compressor/lib/Combine/BorderRadius.php +0 -262
  47. data/templates/project/files/build/tools/css-compressor/lib/Combine/Font.php +0 -125
  48. data/templates/project/files/build/tools/css-compressor/lib/Combine/List.php +0 -104
  49. data/templates/project/files/build/tools/css-compressor/lib/Combine/MarginPadding.php +0 -190
  50. data/templates/project/files/build/tools/css-compressor/lib/Combine.php +0 -191
  51. data/templates/project/files/build/tools/css-compressor/lib/Compress.php +0 -212
  52. data/templates/project/files/build/tools/css-compressor/lib/Control.php +0 -236
  53. data/templates/project/files/build/tools/css-compressor/lib/Exception.php +0 -32
  54. data/templates/project/files/build/tools/css-compressor/lib/Format.php +0 -187
  55. data/templates/project/files/build/tools/css-compressor/lib/Individuals.php +0 -307
  56. data/templates/project/files/build/tools/css-compressor/lib/Numeric.php +0 -103
  57. data/templates/project/files/build/tools/css-compressor/lib/Option.php +0 -133
  58. data/templates/project/files/build/tools/css-compressor/lib/Organize.php +0 -149
  59. data/templates/project/files/build/tools/css-compressor/lib/Selectors.php +0 -245
  60. data/templates/project/files/build/tools/css-compressor/lib/Setup.php +0 -292
  61. data/templates/project/files/build/tools/css-compressor/lib/Trim.php +0 -213
  62. data/templates/project/files/build/tools/css-compressor/license.txt +0 -21
  63. data/templates/project/files/build/tools/htmlcompressor-0.9.8.jar +0 -0
  64. data/templates/project/files/google.yml +0 -22
  65. data/templates/project/files/lighttpd.conf +0 -149
  66. data/templates/project/files/mime.types +0 -80
  67. data/templates/project/files/nginx.conf +0 -108
  68. data/templates/project/files/web.config +0 -207
  69. data/templates/project/javascripts/libs/jquery-1.5.0.min.js +0 -16
  70. data/templates/project/javascripts/libs/modernizr-1.6.min.js +0 -30
@@ -1,636 +1,821 @@
1
1
  <?xml version="1.0"?>
2
2
  <project name="Boilerplate Build" default="build" basedir="../"> <!-- one back since we're in build/ -->
3
-
4
-
5
- <!-- Load in Ant-Contrib to give us access to some very useful tasks! -->
6
- <!-- the .jar file is located in the tools directory -->
7
- <taskdef resource="net/sf/antcontrib/antcontrib.properties">
8
- <classpath>
9
- <pathelement location="${basedir}/build/tools/ant-contrib-1.0b3.jar"/>
10
- </classpath>
11
- </taskdef>
12
-
13
-
14
- <!-- load property files -->
15
- <property file="build/config/project.properties"/>
16
- <property file="build/config/default.properties"/>
17
-
18
- <!-- merge the stylesheet properties -->
19
- <var name="stylesheet-files" value="${file.stylesheets}, ${file.default.stylesheets}"/>
20
-
21
- <!-- merge the pages properties -->
22
- <var name="page-files" value="${file.pages}, ${file.pages.default.include}"/>
23
3
 
24
-
25
-
26
- <!--
27
- *************************************************
28
- * BASE TARGETS *
29
- *************************************************
30
- -->
31
- <target name="basics">
32
- <if>
33
- <equals arg1="${env}" arg2="dev"/>
34
- <then>
35
- <!-- Build a dev environment -->
36
- <echo message="Building a Development Environment..."/>
37
- <antcall target="-rev"/>
38
- <antcall target="-clean"/>
39
- <antcall target="-copy"/>
40
- </then>
41
-
42
- <elseif>
43
- <equals arg1="${env}" arg2="test"/>
44
- <then>
45
- <!-- Build a test environment -->
46
- <echo message="Building a Test Environment..."/>
47
- <antcall target="-rev"/>
48
- <antcall target="-clean"/>
49
- <antcall target="-copy"/>
50
- <antcall target="-usemin"/>
51
- <antcall target="-js.all.minify"/>
52
- <antcall target="-js.main.concat"/>
53
- <antcall target="-js.mylibs.concat"/>
54
- <antcall target="-js.scripts.concat"/>
55
- <antcall target="-js.delete"/>
56
- <antcall target="-css"/>
57
- <antcall target="-html"/>
58
- </then>
59
- </elseif>
60
-
61
- <else>
62
- <!-- Build a production environment -->
63
- <echo message="Building a Production Environment..."/>
64
- <antcall target="-rev"/>
65
- <antcall target="-clean"/>
66
- <antcall target="-copy"/>
67
- <antcall target="-usemin"/>
68
- <antcall target="-js.all.minify"/>
69
- <antcall target="-js.main.concat"/>
70
- <antcall target="-js.mylibs.concat"/>
71
- <antcall target="-js.scripts.concat"/>
72
- <antcall target="-js.delete"/>
73
- <antcall target="-strip-console.log"/>
74
- <antcall target="-css"/>
75
- <antcall target="-html"/>
76
- </else>
77
- </if>
78
- </target>
79
-
80
-
81
- <target name="text">
82
- <if>
83
- <equals arg1="${env}" arg2="dev"/>
84
- <then>
85
- <!-- Build a dev environment -->
86
- <echo message="Building a Development Environment..."/>
87
- <antcall target="-rev"/>
88
- <antcall target="-clean"/>
89
- <antcall target="-copy"/>
90
- </then>
91
-
92
- <elseif>
93
- <equals arg1="${env}" arg2="test"/>
94
- <then>
95
- <!-- Build a test environment -->
96
- <echo message="Building a Test Environment..."/>
97
- <antcall target="-rev"/>
98
- <antcall target="-clean"/>
99
- <antcall target="-copy"/>
100
- <antcall target="-usemin"/>
101
- <antcall target="-js.all.minify"/>
102
- <antcall target="-js.main.concat"/>
103
- <antcall target="-js.mylibs.concat"/>
104
- <antcall target="-js.scripts.concat"/>
105
- <antcall target="-js.delete"/>
106
- <antcall target="-css"/>
107
- <antcall target="-html"/>
108
- <antcall target="-htmlclean"/>
109
- </then>
110
- </elseif>
111
-
112
- <else>
113
- <!-- Build a production environment -->
114
- <echo message="Building a Production Environment..."/>
115
- <antcall target="-rev"/>
116
- <antcall target="-clean"/>
117
- <antcall target="-copy"/>
118
- <antcall target="-usemin"/>
119
- <antcall target="-js.all.minify"/>
120
- <antcall target="-js.main.concat"/>
121
- <antcall target="-js.mylibs.concat"/>
122
- <antcall target="-js.scripts.concat"/>
123
- <antcall target="-js.delete"/>
124
- <antcall target="-strip-console.log"/>
125
- <antcall target="-css"/>
126
- <antcall target="-html"/>
127
- <antcall target="-htmlclean"/>
128
- </else>
129
- </if>
130
- </target>
131
-
132
-
133
- <target name="buildkit">
134
- <if>
135
- <equals arg1="${env}" arg2="dev"/>
136
- <then>
137
- <!-- Build a dev environment -->
138
- <echo message="Building a Development Environment..."/>
139
- <antcall target="-rev"/>
140
- <antcall target="-clean"/>
141
- <antcall target="-copy"/>
142
- <antcall target="-imagespng"/>
143
- <antcall target="-imagesjpg"/>
144
- </then>
145
-
146
- <elseif>
147
- <equals arg1="${env}" arg2="test"/>
148
- <then>
149
- <!-- Build a test environment -->
150
- <echo message="Building a Test Environment..."/>
151
- <antcall target="-rev"/>
152
- <antcall target="-clean"/>
153
- <antcall target="-copy"/>
154
- <antcall target="-usemin"/>
155
- <antcall target="-js.all.minify"/>
156
- <antcall target="-js.main.concat"/>
157
- <antcall target="-js.mylibs.concat"/>
158
- <antcall target="-js.scripts.concat"/>
159
- <antcall target="-js.delete"/>
160
- <antcall target="-css"/>
161
- <antcall target="-html"/>
162
- <antcall target="-htmlbuildkit"/>
163
- <antcall target="-imagespng"/>
164
- <antcall target="-imagesjpg"/>
165
- </then>
166
- </elseif>
167
-
168
- <else>
169
- <!-- Build a production environment -->
170
- <echo message="Building a Production Environment..."/>
171
- <antcall target="-rev"/>
172
- <antcall target="-clean"/>
173
- <antcall target="-copy"/>
174
- <antcall target="-usemin"/>
175
- <antcall target="-js.all.minify"/>
176
- <antcall target="-js.main.concat"/>
177
- <antcall target="-js.mylibs.concat"/>
178
- <antcall target="-js.scripts.concat"/>
179
- <antcall target="-js.delete"/>
180
- <antcall target="-strip-console.log"/>
181
- <antcall target="-css"/>
182
- <antcall target="-html"/>
183
- <antcall target="-htmlbuildkit"/>
184
- <antcall target="-imagespng"/>
185
- <antcall target="-imagesjpg"/>
186
- </else>
187
- </if>
188
- </target>
189
-
190
-
191
- <target name="build">
192
- <if>
193
- <equals arg1="${env}" arg2="dev"/>
194
- <then>
195
- <!-- Build a dev environment -->
196
- <echo message="Building a Development Environment..."/>
197
- <antcall target="-rev"/>
198
- <antcall target="-clean"/>
199
- <antcall target="-copy"/>
200
- <antcall target="-imagespng"/>
201
- <antcall target="-imagesjpg"/>
202
- </then>
203
-
204
- <elseif>
205
- <equals arg1="${env}" arg2="test"/>
206
- <then>
207
- <!-- Build a test environment -->
208
- <echo message="Building a Test Environment..."/>
209
- <antcall target="-rev"/>
210
- <antcall target="-clean"/>
211
- <antcall target="-copy"/>
212
- <antcall target="-usemin"/>
213
- <antcall target="-js.all.minify"/>
214
- <antcall target="-js.main.concat"/>
215
- <antcall target="-js.mylibs.concat"/>
216
- <antcall target="-js.scripts.concat"/>
217
- <antcall target="-js.delete"/>
218
- <antcall target="-css"/>
219
- <antcall target="-html"/>
220
- <antcall target="-htmlclean"/>
221
- <antcall target="-imagespng"/>
222
- <antcall target="-imagesjpg"/>
223
- </then>
224
- </elseif>
225
-
226
- <else>
227
- <!-- Build a production environment -->
228
- <echo message="Building a Production Environment..."/>
229
- <antcall target="-rev"/>
230
- <antcall target="-clean"/>
231
- <antcall target="-copy"/>
232
- <antcall target="-usemin"/>
233
- <antcall target="-js.all.minify"/>
234
- <antcall target="-js.main.concat"/>
235
- <antcall target="-js.mylibs.concat"/>
236
- <antcall target="-js.scripts.concat"/>
237
- <antcall target="-js.delete"/>
238
- <antcall target="-strip-console.log"/>
239
- <antcall target="-css"/>
240
- <antcall target="-html"/>
241
- <antcall target="-htmlclean"/>
242
- <antcall target="-imagespng"/>
243
- <antcall target="-imagesjpg"/>
244
- </else>
245
- </if>
246
- </target>
247
-
248
-
249
- <target name="minify">
250
- <if>
251
- <equals arg1="${env}" arg2="dev"/>
252
- <then>
253
- <!-- Build a dev environment -->
254
- <echo message="Building a Development Environment..."/>
255
- <antcall target="-rev"/>
256
- <antcall target="-clean"/>
257
- <antcall target="-copy"/>
258
- <antcall target="-imagespng"/>
259
- <antcall target="-imagesjpg"/>
260
- </then>
261
-
262
- <elseif>
263
- <equals arg1="${env}" arg2="test"/>
264
- <then>
265
- <!-- Build a test environment -->
266
- <echo message="Building a Test Environment..."/>
267
- <antcall target="-rev"/>
268
- <antcall target="-clean"/>
269
- <antcall target="-copy"/>
270
- <antcall target="-usemin"/>
271
- <antcall target="-js.all.minify"/>
272
- <antcall target="-js.main.concat"/>
273
- <antcall target="-js.mylibs.concat"/>
274
- <antcall target="-js.scripts.concat"/>
275
- <antcall target="-js.delete"/>
276
- <antcall target="-css"/>
277
- <antcall target="-html"/>
278
- <antcall target="-htmlcompress"/>
279
- <antcall target="-imagespng"/>
280
- <antcall target="-imagesjpg"/>
281
- </then>
282
- </elseif>
283
-
284
- <else>
285
- <!-- Build a production environment -->
286
- <echo message="Building a Production Environment..."/>
287
- <antcall target="-rev"/>
288
- <antcall target="-clean"/>
289
- <antcall target="-copy"/>
290
- <antcall target="-usemin"/>
291
- <antcall target="-js.all.minify"/>
292
- <antcall target="-js.main.concat"/>
293
- <antcall target="-js.mylibs.concat"/>
294
- <antcall target="-js.scripts.concat"/>
295
- <antcall target="-js.delete"/>
296
- <antcall target="-strip-console.log"/>
297
- <antcall target="-css"/>
298
- <antcall target="-html"/>
299
- <antcall target="-htmlcompress"/>
300
- <antcall target="-imagespng"/>
301
- <antcall target="-imagesjpg"/>
302
- </else>
303
- </if>
304
- </target>
305
-
306
-
307
- <!--
308
- *************************************************
309
- * FUNCTION TARGETS *
310
- *************************************************
311
- -->
312
- <target name="-load-build-info" description="(PRIVATE) Loads the build versioning information">
313
- <property file="./${dir.build}/config/${build.version.info}"/>
314
- </target>
315
-
316
- <target name="-clean" description="(PRIVATE) Wipe the previous build (Deletes the dir.publish directory">
317
- <!-- This is a private target -->
318
-
319
- <echo message="Cleaning up previous build directory..."/>
320
- <delete dir="./${dir.publish}/"/>
321
- </target>
322
-
323
-
324
- <target name="-rev" description="(PRIVATE) Increase the current build number by one and set build date">
325
- <!-- This is a private target -->
326
-
327
- <echo message="Increasing the build number..."/>
328
- <propertyfile file="./${dir.build}/config/${build.version.info}" comment="Build Information File - DO NOT CHANGE">
329
- <entry key="build.number" type="int" default="0000" operation="+" pattern="0000"/>
330
- <entry key="build.date" type="date" value="now" pattern="dd.MM.yyyy HH:mm"/>
331
- </propertyfile>
332
- <property file="./${dir.build}/config/${build.version.info}"/>
333
- <echo>Creating build ${build.number}</echo>
334
- </target>
335
-
336
-
337
- <target name="current-number" depends="-load-build-info" description="(PUBLIC) Returns the current build number">
338
- <echo>Current build number: ${build.number}</echo>
339
- </target>
340
-
341
-
342
- <target name="-copy" depends="-load-build-info">
343
- <!-- This is a private target -->
344
-
345
- <echo message="Copying over new files..."/>
346
- <!-- combine the 2 exclude properties -->
347
- <var name="excluded-files" value="${file.default.exclude}, ${file.exclude}"/>
348
-
349
- <copy todir="./${dir.publish}">
350
- <fileset dir="./" excludes="${excluded-files}"/>
351
- </copy>
352
- </target>
353
-
354
-
355
- <!-- JAVASCRIPT -->
356
- <target name="-js.main.concat" depends="-load-build-info" description="(PRIVATE) Concatenates the JS files in dir.js">
357
- <echo message="Concatenating Main JS scripts..."/>
358
- <concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}.js">
359
- <fileset dir="./${dir.publish}/">
360
- <include name="**/${dir.js.main}/*.min.js"/>
361
- <exclude name="**/${dir.js.mylibs}/*.js"/>
362
- <exclude name="**/${dir.js.libs}/*.js"/>
363
- </fileset>
364
- </concat>
365
- </target>
366
-
367
-
368
- <target name="-js.mylibs.concat" depends="-load-build-info" description="(PRIVATE) Concatenates the JS files in dir.js.mylibs">
369
- <echo message="Concatenating JS libraries"/>
370
- <concat destfile="./${dir.publish}/${dir.js}/libs-${build.number}.js">
371
- <fileset dir="./${dir.publish}/${dir.js.mylibs}/">
372
- <include name="**/*.min.js"/>
373
- </fileset>
374
- </concat>
375
- </target>
376
-
377
-
378
- <target name="-js.scripts.concat" depends="-load-build-info" if="build.concat.scripts">
379
- <echo message="Concatenating library file with main script file"/>
380
- <concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}.min.js">
381
- <fileset dir="./${dir.publish}/${dir.js}/">
382
- <include name="libs-${build.number}.js"/>
383
- <include name="scripts-${build.number}.js"/>
384
- </fileset>
385
- </concat>
386
-
387
- <echo message="Concatenating library file with main debug script file"/>
388
- <concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}-debug.min.js">
389
- <fileset dir="./${dir.publish}/${dir.js}/">
390
- <include name="libs-${build.number}.js"/>
391
- <include name="scripts-${build.number}-debug.js"/>
392
- </fileset>
393
- </concat>
394
- </target>
395
-
396
-
397
- <target name="-js.all.minify" depends="-js.libs.minify" description="(PRIVATE) Minifies the scripts.js files created by js.scripts.concat">
398
- <echo message="Minifying concatenated script- and library-file"/>
399
- <apply executable="java" parallel="false">
400
- <fileset dir="./${dir.publish}/${dir.js}">
401
- <include name="**/*.js"/>
402
- <exclude name="**/*.min.js"/>
403
- <exclude name="**/${dir.js.libs}/*.js"/>
404
- </fileset>
405
- <arg line="-jar"/>
406
- <arg path="./${dir.build.tools}/${tool.yuicompressor}"/>
407
- <srcfile/>
408
- <arg line="--line-break"/>
409
- <arg line="4000"/>
410
- <arg line="-o"/>
411
- <mapper type="glob" from="*.js" to="../${dir.publish}/${dir.js}/*.min.js"/>
412
- <targetfile/>
413
- </apply>
414
- </target>
415
4
 
416
-
417
- <target name="-js.libs.minify" depends="-load-build-info" description="(PRIVATE) Minifies the helper files in dir.js.libs">
418
- <echo message="Minifying helper JS files..."/>
419
-
420
- <apply executable="java" parallel="false">
421
- <fileset dir="./${dir.publish}/${dir.js.libs}/" includes="*.js" excludes="*.min.js"/>
422
- <arg line="-jar"/>
423
- <arg path="./${dir.build.tools}/${tool.yuicompressor}"/>
424
- <srcfile/>
425
- <arg line="-o"/>
426
- <mapper type="glob" from="*.js" to="../${dir.publish}/${dir.js.libs}/*-${build.number}.min.js"/>
427
- <targetfile/>
428
- </apply>
429
- </target>
430
-
431
-
432
- <target name="-js.delete" depends="-load-build-info" description="(PRIVATE) Deletes the unoptimized js files from build if set">
433
- <if>
434
- <equals arg1="${build.delete.unoptimized}" arg2="true"/>
435
- <then>
436
- <echo message="Deleting unoptimized files..."/>
437
- <delete file="./${dir.publish}/${dir.js}/scripts-${build.number}.js"/>
438
- <delete file="./${dir.publish}/${dir.js}/scripts-${build.number}-debug.js"/>
439
- <!--
440
- <delete dir="./${dir.publish}/${dir.js.lib}/"/>
441
- <delete file="./${dir.publish}/${dir.js}/libs-${build.number}.js"/>
442
- this guy probably COULD be on but I think it's better if we keep him off for now. ^pi
443
- <delete includeemptydirs="true">
444
- <fileset dir="./${dir.publish}/${dir.js.libs}/" includes="*.js" excludes="*.min.js"/>
445
- </delete>
446
- -->
447
- </then>
448
- </if>
449
-
450
- <if>
451
- <and>
452
- <equals arg1="${build.delete.unoptimized}" arg2="true"/>
453
- <equals arg1="${build.concat.scripts}" arg2="true"/>
454
- </and>
455
- <then>
456
- <delete file="./${dir.publish}/${dir.js}/libs-${build.number}.js"/>
457
- <delete file="./${dir.publish}/${dir.js}/scripts-${build.number}.js"/>
458
- </then>
459
- </if>
460
- </target>
461
-
462
-
463
- <target name="-strip-console.log" description="(PRIVATE)Comments out any console.log statements">
464
- <echo message="Commenting out console.log lines"/>
5
+ <!-- Load in Ant-Contrib to give us access to some very useful tasks! -->
6
+ <!-- the .jar file is located in the tools directory -->
7
+ <taskdef resource="net/sf/antcontrib/antcontrib.properties">
8
+ <classpath>
9
+ <pathelement location="${basedir}/build/tools/ant-contrib-1.0b3.jar"/>
10
+ </classpath>
11
+ </taskdef>
465
12
 
13
+ <!-- load shell environment -->
14
+ <property environment="ENV" />
466
15
 
467
- <replaceregexp match="(console.log\(.*\))" replace="/\*\1\*/" flags="g" >
468
- <fileset dir="./${dir.publish}/${dir.js}/">
469
- <include name="**/*.js"/>
470
- <exclude name="**/*.min.js"/>
471
- </fileset>
472
- </replaceregexp>
473
- </target>
474
-
475
-
476
- <!-- HTML -->
477
- <target name="-usemin" depends="-serverconfig" description="(PRIVATE) Replaces references to non-minified scripts">
478
- <echo message="Switching to minified js files..."/>
479
-
480
- <!-- switch from a regular jquery to minified -->
481
- <replaceregexp match="jquery-(\d|\d(\.\d)+)\.js" replace="jquery-\1.min.js" flags="">
482
- <fileset dir="./${dir.publish}" includes="${page-files}"/>
483
- </replaceregexp>
484
- <!-- switch any google CDN reference to minified -->
485
- <replaceregexp match="(\d|\d(\.\d)+)\/jquery\.js" replace="\1/jquery.min.js" flags="">
486
- <fileset dir="./${dir.publish}" includes="${page-files}"/>
487
- </replaceregexp>
488
-
489
- <echo>kill off those versioning flags: ?v=2</echo>
490
- <replaceregexp match='\?v=\d+">' replace='">' flags="">
491
- <fileset dir="./${dir.publish}" includes="${page-files}"/>
492
- </replaceregexp>
493
- </target>
494
-
495
-
496
- <target name="-html" depends="-load-build-info" description="(PRIVATE) Very basic clean up of the HTML">
497
- <echo message="Clean up the html..."/>
498
- <!-- style.css replacement handled as a replacetoken above -->
499
- <replaceregexp match="&lt;!-- scripts concatenated [\d\w\s\W]*?!-- end concatenated and minified scripts--&gt;" replace="&lt;script src='${dir.js}/scripts-${build.number}.min.js\'&gt;&lt;/script&gt;" flags="m">
500
- <fileset dir="./${dir.publish}" includes="${page-files}"/>
501
- </replaceregexp>
502
- <!--[! use comments like this one to avoid having them get minified -->
503
- </target>
504
-
505
-
506
- <target name="-htmlclean">
507
- <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
508
- <fileset dir="./${dir.publish}/" includes="${page-files}"/>
509
- <arg value="-jar"/>
510
- <arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
511
- <arg line="--type html"/>
512
- <arg line="--preserve-multi-spaces"/>
513
- <arg line="--remove-quotes"/>
514
- <arg line="--compress-js"/>
515
- <arg line="--compress-css"/>
516
- <srcfile/>
517
- <arg value="-o"/>
518
- <mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
519
- <targetfile/>
520
- </apply>
521
- </target>
522
-
523
-
524
- <target name="-htmlbuildkit">
525
- <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
526
- <fileset dir="./${dir.publish}/" includes="${page-files}"/>
527
- <arg value="-jar"/>
528
- <arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
529
- <arg value="--preserve-comments"/>
530
- <arg line="--preserve-multi-spaces"/>
531
- <arg line="--type html"/>
532
- <arg line="--compress-js"/>
533
- <arg line="--compress-css"/>
534
- <srcfile/>
535
- <arg value="-o"/>
536
- <mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
537
- <targetfile/>
538
- </apply>
539
- </target>
540
-
541
-
542
- <target name="-htmlcompress">
543
- <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
544
- <fileset dir="./${dir.publish}/" includes="${page-files}"/>
545
- <arg value="-jar"/>
546
- <arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
547
- <arg line="--type html"/>
548
- <arg line="--remove-quotes"/>
549
- <arg line="--compress-js"/>
550
- <arg line="--compress-css"/>
551
- <srcfile/>
552
- <arg value="-o"/>
553
- <mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
554
- <targetfile/>
555
- </apply>
556
- </target>
557
-
558
-
559
- <target name="-serverconfig" description="(PRIVATE) Upgrades expires headers">
560
- <echo message="Upgrading expires header timeouts for js/css"/>
561
- <replace file="./${dir.publish}/${file.serverconfig}" token="access plus 2 months" value="access plus 1 year"/>
562
- </target>
16
+ <!-- load property files -->
17
+ <property file="build/config/project.properties"/>
18
+ <property file="build/config/default.properties"/>
563
19
 
564
-
565
- <!-- CSS -->
566
- <target name="-css" description="Concatenates and Minifies any stylesheets listed in the file.stylesheets property">
567
- <echo message="Minifying css..."/>
568
-
569
- <concat destfile="./${dir.publish}/${dir.css}/style-${build.number}.css">
570
- <filelist dir="./${dir.publish}/${dir.css}" files="${stylesheet-files}"/>
571
- </concat>
572
- <apply executable="php" parallel="false">
573
- <fileset dir="./${dir.publish}/${dir.css}/" includes="style-${build.number}.css"/>
574
- <arg line="-f"/>
575
- <arg path="./${dir.build.tools}/${tool.csscompressor}"/>
576
- <srcfile/>
577
- <redirector>
578
- <outputmapper type="glob" from="style-${build.number}.css" to="./${dir.publish}/${dir.css}/style-${build.number}.min.css"/>
579
- </redirector>
580
- </apply>
581
- <replace token="style.css" value="style-${build.number}.min.css" dir="${dir.publish}" includes="${page-files}"/>
582
- </target>
583
-
584
-
585
- <!-- IMAGES -->
586
- <target name="-imagespng" description="(PRIVATE) Optimizes .png images using optipng">
587
- <echo message="Optimizing images"/>
588
-
589
- <!-- osfamily=unix is actually true on OS X as well -->
590
- <apply executable="optipng" osfamily="unix">
591
- <arg value="-o7"/>
592
- <fileset dir="./${dir.publish}/">
593
- <include name="**/*.png"/>
594
- </fileset>
595
- </apply>
596
- <apply executable="tools/optipng-0.6.4-exe/optipng.exe" osfamily="windows">
597
- <arg value="-o7"/>
598
- <fileset dir="./${dir.publish}/">
599
- <include name="**/*.png"/>
600
- </fileset>
601
- </apply>
602
- </target>
603
-
604
-
605
- <target name="-imagesjpg" description="(PRIVATE) Optimizes .jpg images using jpegtan">
606
- <echo message="Clean up those jpgs..."/>
607
- <if>
608
- <equals arg1="${images.strip.metadata}" arg2="true"/>
609
- <then>
610
- <var name="strip-meta-tags" value="none"/>
611
- </then>
612
- <else>
613
- <var name="strip-meta-tags" value="all"/>
614
- </else>
615
- </if>
616
- <apply executable="jpegtran" osfamily="unix">
617
- <fileset dir="./${dir.publish}/${dir.images}/" includes="*.jpg"/>
618
- <arg value="-copy"/>
619
- <arg value="${strip-meta-tags}"/>
620
- <srcfile/>
621
- <targetfile/>
622
- <!-- you may want to flag optimized images. If so, do it here. Otherwise change this to type="identity" -->
623
- <mapper type="glob" from="*.jpg" to="../${dir.publish}/${dir.images}/*.jpg"/>
624
- </apply>
625
- <apply executable="tools/jpegtran.exe" osfamily="windows">
626
- <fileset dir="./${dir.publish}/${dir.images}/" includes="*.jpg"/>
627
- <arg value="-copy"/>
628
- <arg value="${strip-meta-tags}"/>
629
- <srcfile/>
630
- <targetfile/>
631
- <!-- you may want to flag optimized images. If so, do it here. Otherwise change this to type="identity" -->
632
- <mapper type="glob" from="*.jpg" to="../${dir.publish}/${dir.images}/*.jpg"/>
633
- </apply>
634
- </target>
635
-
20
+ <!-- merge the stylesheet properties -->
21
+ <var name="stylesheet-files" value="${file.stylesheets}, ${file.default.stylesheets}"/>
22
+
23
+ <!-- merge the pages properties -->
24
+ <var name="page-files" value="${file.pages}, ${file.pages.default.include}"/>
25
+
26
+
27
+
28
+ <!--
29
+ *************************************************
30
+ * BASE TARGETS *
31
+ *************************************************
32
+ -->
33
+ <target name="basics">
34
+ <if>
35
+ <equals arg1="${env}" arg2="dev"/>
36
+ <then>
37
+ <!-- Build a dev environment -->
38
+ <echo message="Building a Development Environment..."/>
39
+ <antcall target="-basics.dev"/>
40
+ </then>
41
+
42
+ <elseif>
43
+ <equals arg1="${env}" arg2="test"/>
44
+ <then>
45
+ <!-- Build a test environment -->
46
+ <echo message="Building a Test Environment..."/>
47
+ <antcall target="-basics.test"/>
48
+ </then>
49
+ </elseif>
50
+
51
+ <else>
52
+ <!-- Build a production environment -->
53
+ <echo message="Building a Production Environment..."/>
54
+ <antcall target="-basics.production"/>
55
+ </else>
56
+ </if>
57
+ </target>
58
+
59
+
60
+ <target name="text">
61
+ <if>
62
+ <equals arg1="${env}" arg2="dev"/>
63
+ <then>
64
+ <!-- Build a dev environment -->
65
+ <echo message="Building a Development Environment..."/>
66
+ <antcall target="-text.dev"/>
67
+ </then>
68
+
69
+ <elseif>
70
+ <equals arg1="${env}" arg2="test"/>
71
+ <then>
72
+ <!-- Build a test environment -->
73
+ <echo message="Building a Test Environment..."/>
74
+ <antcall target="-text.test"/>
75
+ </then>
76
+ </elseif>
77
+
78
+ <else>
79
+ <!-- Build a production environment -->
80
+ <echo message="Building a Production Environment..."/>
81
+ <antcall target="-text.production"/>
82
+ </else>
83
+ </if>
84
+ <!-- funky order due to jpegtran being a jerk. See comment at top of imagesjpg task -->
85
+ <antcall target="-jpgcopy"/>
86
+ </target>
87
+
88
+
89
+ <target name="buildkit">
90
+ <if>
91
+ <equals arg1="${env}" arg2="dev"/>
92
+ <then>
93
+ <!-- Build a dev environment -->
94
+ <echo message="Building a Development Environment..."/>
95
+ <antcall target="-buildkit.dev"/>
96
+ </then>
97
+
98
+ <elseif>
99
+ <equals arg1="${env}" arg2="test"/>
100
+ <then>
101
+ <!-- Build a test environment -->
102
+ <echo message="Building a Test Environment..."/>
103
+ <antcall target="-buildkit.test"/>
104
+ </then>
105
+ </elseif>
106
+
107
+ <else>
108
+ <!-- Build a production environment -->
109
+ <echo message="Building a Production Environment..."/>
110
+ <antcall target="-buildkit.production"/>
111
+ </else>
112
+ </if>
113
+ </target>
114
+
115
+
116
+ <target name="build">
117
+ <if>
118
+ <equals arg1="${env}" arg2="dev"/>
119
+ <then>
120
+ <!-- Build a dev environment -->
121
+ <echo message="Building a Development Environment..."/>
122
+ <antcall target="-build.dev" />
123
+ </then>
124
+
125
+ <elseif>
126
+ <equals arg1="${env}" arg2="test"/>
127
+ <then>
128
+ <!-- Build a test environment -->
129
+ <echo message="Building a Test Environment..."/>
130
+ <antcall target="-build.test" />
131
+ </then>
132
+ </elseif>
133
+
134
+ <else>
135
+ <!-- Build a production environment -->
136
+ <echo message="Building a Production Environment..."/>
137
+ <antcall target="-build.production" />
138
+ </else>
139
+ </if>
140
+ </target>
141
+
142
+
143
+ <target name="minify">
144
+ <if>
145
+ <equals arg1="${env}" arg2="dev"/>
146
+ <then>
147
+ <!-- Build a dev environment -->
148
+ <echo message="Building a Development Environment..."/>
149
+ <antcall target="-minify.dev"/>
150
+ </then>
151
+
152
+ <elseif>
153
+ <equals arg1="${env}" arg2="test"/>
154
+ <then>
155
+ <!-- Build a test environment -->
156
+ <echo message="Building a Test Environment..."/>
157
+ <antcall target="-minify.test"/>
158
+ </then>
159
+ </elseif>
160
+
161
+ <else>
162
+ <!-- Build a production environment -->
163
+ <echo message="Building a Production Environment..."/>
164
+ <antcall target="-minify.production"/>
165
+ </else>
166
+ </if>
167
+ </target>
168
+
169
+
170
+ <!--
171
+ *************************************************
172
+ * BUILD TARGETS *
173
+ *************************************************
174
+ -->
175
+
176
+ <!-- Target: basics -->
177
+ <target name="-basics.dev"
178
+ depends="-rev,
179
+ -clean,
180
+ -copy"/>
181
+
182
+ <target name="-basics.test"
183
+ depends="-rev,
184
+ -clean,
185
+ -copy,
186
+ -usemin,
187
+ -js.all.minify,
188
+ -js.main.concat,
189
+ -js.mylibs.concat,
190
+ -js.scripts.concat,
191
+ -js.delete,
192
+ -css,
193
+ -html"/>
194
+
195
+ <target name="-basics.production"
196
+ depends="-rev,
197
+ -clean,
198
+ -copy,
199
+ -usemin,
200
+ -js.all.minify,
201
+ -js.main.concat,
202
+ -js.mylibs.concat,
203
+ -js.scripts.concat,
204
+ -js.delete,
205
+ -strip-console.log,
206
+ -css,
207
+ -html"/>
208
+
209
+ <!-- Target: text -->
210
+ <target name="-text.dev"
211
+ depends="-rev,
212
+ -clean,
213
+ -copy"/>
214
+
215
+ <target name="-text.test"
216
+ depends="-rev,
217
+ -clean,
218
+ -copy,
219
+ -usemin,
220
+ -js.all.minify,
221
+ -js.main.concat,
222
+ -js.mylibs.concat,
223
+ -js.scripts.concat,
224
+ -js.delete,
225
+ -css,
226
+ -html,
227
+ -htmlclean"/>
228
+
229
+ <target name="-text.production"
230
+ depends="-rev,
231
+ -clean,
232
+ -copy,
233
+ -usemin,
234
+ -js.all.minify,
235
+ -js.main.concat,
236
+ -js.mylibs.concat,
237
+ -js.scripts.concat,
238
+ -js.delete,
239
+ -strip-console.log,
240
+ -css,
241
+ -html,
242
+ -htmlclean"/>
243
+
244
+ <!-- Target: buildkit -->
245
+ <target name="-buildkit.dev"
246
+ depends="-rev,
247
+ -clean,
248
+ -prodcopy,
249
+ -imagespng,
250
+ -imagesjpg"/>
251
+
252
+ <target name="-buildkit.test"
253
+ depends="-rev,
254
+ -clean,
255
+ -prodcopy,
256
+ -usemin,
257
+ -js.all.minify,
258
+ -js.main.concat,
259
+ -js.mylibs.concat,
260
+ -js.scripts.concat,
261
+ -js.delete,
262
+ -css,
263
+ -html,
264
+ -htmlbuildkit,
265
+ -imagespng,
266
+ -imagesjpg"/>
267
+
268
+ <target name="-buildkit.production"
269
+ depends="-rev,
270
+ -clean,
271
+ -prodcopy,
272
+ -usemin,
273
+ -js.all.minify,
274
+ -js.main.concat,
275
+ -js.mylibs.concat,
276
+ -js.scripts.concat,
277
+ -js.delete,
278
+ -strip-console.log,
279
+ -css,
280
+ -html,
281
+ -htmlbuildkit,
282
+ -imagespng,
283
+ -imagesjpg"/>
284
+
285
+ <!-- Target: build -->
286
+ <target name="-build.dev"
287
+ depends="-rev,
288
+ -clean,
289
+ -prodcopy,
290
+ -imagespng,
291
+ -imagesjpg"/>
292
+
293
+ <target name="-build.test"
294
+ depends="-rev,
295
+ -clean,
296
+ -prodcopy,
297
+ -usemin,
298
+ -js.all.minify,
299
+ -js.main.concat,
300
+ -js.mylibs.concat,
301
+ -js.scripts.concat,
302
+ -js.delete,
303
+ -css,
304
+ -html,
305
+ -htmlclean,
306
+ -imagespng,
307
+ -imagesjpg"/>
308
+
309
+ <target name="-build.production"
310
+ depends="-rev,
311
+ -clean,
312
+ -prodcopy,
313
+ -usemin,
314
+ -js.all.minify,
315
+ -js.main.concat,
316
+ -js.mylibs.concat,
317
+ -js.scripts.concat,
318
+ -js.delete,
319
+ -strip-console.log,
320
+ -css,
321
+ -html,
322
+ -htmlclean,
323
+ -imagespng,
324
+ -imagesjpg"/>
325
+
326
+ <!-- Target: minify -->
327
+ <target name="-minify.dev"
328
+ depends="-rev,
329
+ -clean,
330
+ -prodcopy,
331
+ -imagespng,
332
+ -imagesjpg"/>
333
+
334
+ <target name="-minify.test"
335
+ depends="-rev,
336
+ -clean,
337
+ -prodcopy,
338
+ -usemin,
339
+ -js.all.minify,
340
+ -js.main.concat,
341
+ -js.mylibs.concat,
342
+ -js.scripts.concat,
343
+ -js.delete,
344
+ -css,
345
+ -html,
346
+ -htmlcompress,
347
+ -imagespng,
348
+ -imagesjpg"/>
349
+
350
+ <target name="-minify.production"
351
+ depends="-rev,
352
+ -clean,
353
+ -prodcopy,
354
+ -usemin,
355
+ -js.all.minify,
356
+ -js.main.concat,
357
+ -js.mylibs.concat,
358
+ -js.scripts.concat,
359
+ -js.delete,
360
+ -strip-console.log,
361
+ -css,
362
+ -html,
363
+ -htmlcompress,
364
+ -imagespng,
365
+ -imagesjpg"/>
366
+
367
+ <!--
368
+ *************************************************
369
+ * FUNCTION TARGETS *
370
+ *************************************************
371
+ -->
372
+ <target name="-load-build-info" description="(PRIVATE) Loads the build versioning information">
373
+ <property file="./${dir.build}/config/${build.version.info}"/>
374
+ </target>
375
+
376
+ <target name="-clean" description="(PRIVATE) Wipe the previous build (Deletes the dir.publish directory">
377
+ <!-- This is a private target -->
378
+
379
+ <echo message="Cleaning up previous build directory..."/>
380
+ <delete dir="./${dir.publish}/"/>
381
+ </target>
382
+
383
+
384
+ <target name="-rev" description="(PRIVATE) Increase the current build number by one and set build date">
385
+ <!-- This is a private target -->
386
+
387
+ <echo message="====================================================================="/>
388
+ <echo message="Welcome to the HTML5 Boilerplate Build Script!"/>
389
+ <echo message=" "/>
390
+ <echo message="We're going to get your site all ship-shape and ready for prime time."/>
391
+ <echo message=" "/>
392
+ <echo message="This should take somewhere between 15 seconds and a few minutes,"/>
393
+ <echo message="mostly depending on how many images we're going to compress."/>
394
+ <echo message=" "/>
395
+ <echo message="Feel free to come back or stay here and follow along."/>
396
+ <echo message="====================================================================="/>
397
+ <echo message=" "/>
398
+ <echo message=" "/>
399
+
400
+
401
+ <echo message="Increasing the build number..."/>
402
+ <propertyfile file="./${dir.build}/config/${build.version.info}" comment="Build Information File - DO NOT CHANGE">
403
+ <entry key="build.number" type="int" default="0000" operation="+" pattern="0000"/>
404
+ <entry key="build.date" type="date" value="now" pattern="dd.MM.yyyy HH:mm"/>
405
+ </propertyfile>
406
+ <property file="./${dir.build}/config/${build.version.info}"/>
407
+ <echo>Creating build ${build.number}</echo>
408
+ </target>
409
+
410
+
411
+ <target name="current-number" depends="-load-build-info" description="(PUBLIC) Returns the current build number">
412
+ <echo>Current build number: ${build.number}</echo>
413
+ </target>
414
+
415
+
416
+ <target name="-copy" depends="-load-build-info">
417
+ <!-- This is a private target -->
418
+
419
+ <echo message="Copying over new files..."/>
420
+ <!-- combine the 2 exclude properties -->
421
+ <var name="excluded-files" value="${file.default.exclude}, ${file.exclude}"/>
422
+
423
+ <copy todir="./${dir.publish}">
424
+ <fileset dir="${dir.source}/" excludes="${excluded-files}"/>
425
+ </copy>
426
+
427
+ <echo message="A copy of all non-dev files are now in: ./${dir.publish}."/>
428
+ </target>
429
+
430
+ <target name="-prodcopy" depends="-load-build-info">
431
+ <!-- This is a private target -->
432
+
433
+ <echo message="Copying over new files..."/>
434
+ <!-- combine the 2 exclude properties -->
435
+ <var name="prod-excluded-files" value="${file.default.exclude}, ${file.jpg.exclude}, ${file.exclude}"/>
436
+
437
+ <copy todir="./${dir.publish}">
438
+ <fileset dir="${dir.source}/" excludes="${prod-excluded-files}"/>
439
+ </copy>
440
+
441
+ <echo message="A copy of all non-dev files are now in: ./${dir.publish}."/>
442
+ </target>
443
+
444
+
445
+ <!-- JAVASCRIPT -->
446
+ <target name="-js.main.concat" depends="-load-build-info" description="(PRIVATE) Concatenates the JS files in dir.js">
447
+ <echo message="Concatenating Main JS scripts..."/>
448
+ <concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}.js">
449
+ <fileset dir="./${dir.publish}/">
450
+ <include name="**/${dir.js.main}/*.min.js"/>
451
+ <exclude name="**/${dir.js.mylibs}/*.js"/>
452
+ <exclude name="**/${dir.js.libs}/*.js"/>
453
+ </fileset>
454
+ </concat>
455
+ </target>
456
+
457
+
458
+ <target name="-js.mylibs.concat" depends="-load-build-info" description="(PRIVATE) Concatenates the JS files in dir.js.mylibs">
459
+ <echo message="Concatenating JS libraries"/>
460
+ <concat destfile="./${dir.publish}/${dir.js}/libs-${build.number}.js">
461
+ <fileset dir="./${dir.publish}/${dir.js.mylibs}/">
462
+ <include name="**/*.min.js"/>
463
+ </fileset>
464
+ </concat>
465
+ </target>
466
+
467
+
468
+ <target name="-js.scripts.concat" depends="-load-build-info" if="build.concat.scripts">
469
+ <echo message="Concatenating library file with main script file"/>
470
+ <concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}.min.js">
471
+ <fileset dir="./${dir.publish}/${dir.js}/">
472
+ <include name="libs-${build.number}.js"/>
473
+ <include name="scripts-${build.number}.js"/>
474
+ </fileset>
475
+ </concat>
476
+
477
+ <echo message="Concatenating library file with main debug script file"/>
478
+ <concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}-debug.min.js">
479
+ <fileset dir="./${dir.publish}/${dir.js}/">
480
+ <include name="libs-${build.number}.js"/>
481
+ <include name="scripts-${build.number}-debug.js"/>
482
+ </fileset>
483
+ </concat>
484
+ </target>
485
+
486
+
487
+ <target name="-js.all.minify" depends="-js.libs.minify" description="(PRIVATE) Minifies the scripts.js files created by js.scripts.concat">
488
+ <echo message="Minifying concatenated script- and library-file"/>
489
+ <apply executable="java" parallel="false">
490
+ <fileset dir="./${dir.publish}/${dir.js}">
491
+ <include name="**/*.js"/>
492
+ <exclude name="**/*.min.js"/>
493
+ <exclude name="**/${dir.js.libs}/*.js"/>
494
+ </fileset>
495
+ <arg line="-jar"/>
496
+ <arg path="./${dir.build.tools}/${tool.yuicompressor}"/>
497
+ <srcfile/>
498
+ <arg line="--line-break"/>
499
+ <arg line="4000"/>
500
+ <arg line="-o"/>
501
+ <mapper type="glob" from="*.js" to="../${dir.publish}/${dir.js}/*.min.js"/>
502
+ <targetfile/>
503
+ </apply>
504
+ </target>
505
+
506
+
507
+ <target name="-js.libs.minify" depends="-load-build-info" description="(PRIVATE) Minifies the helper files in dir.js.libs">
508
+ <echo message="Minifying helper JS files..."/>
509
+
510
+ <apply executable="java" parallel="false">
511
+ <fileset dir="./${dir.publish}/${dir.js.libs}/" includes="*.js" excludes="*.min.js"/>
512
+ <arg line="-jar"/>
513
+ <arg path="./${dir.build.tools}/${tool.yuicompressor}"/>
514
+ <srcfile/>
515
+ <arg line="-o"/>
516
+ <mapper type="glob" from="*.js" to="../${dir.publish}/${dir.js.libs}/*-${build.number}.min.js"/>
517
+ <targetfile/>
518
+ </apply>
519
+ </target>
520
+
521
+
522
+ <target name="-js.delete" depends="-load-build-info" description="(PRIVATE) Deletes the unoptimized js files from build if set">
523
+ <if>
524
+ <equals arg1="${build.delete.unoptimized}" arg2="true"/>
525
+ <then>
526
+ <echo message="Deleting unoptimized files..."/>
527
+ <delete file="./${dir.publish}/${dir.js}/scripts-${build.number}.js"/>
528
+ <delete file="./${dir.publish}/${dir.js}/scripts-${build.number}-debug.js"/>
529
+ <!--
530
+ <delete dir="./${dir.publish}/${dir.js.lib}/"/>
531
+ <delete file="./${dir.publish}/${dir.js}/libs-${build.number}.js"/>
532
+ this guy probably COULD be on but I think it's better if we keep him off for now. ^pi
533
+ <delete includeemptydirs="true">
534
+ <fileset dir="./${dir.publish}/${dir.js.libs}/" includes="*.js" excludes="*.min.js"/>
535
+ </delete>
536
+ -->
537
+ </then>
538
+ </if>
539
+
540
+ <if>
541
+ <and>
542
+ <equals arg1="${build.delete.unoptimized}" arg2="true"/>
543
+ <equals arg1="${build.concat.scripts}" arg2="true"/>
544
+ </and>
545
+ <then>
546
+ <delete file="./${dir.publish}/${dir.js}/libs-${build.number}.js"/>
547
+ <delete file="./${dir.publish}/${dir.js}/scripts-${build.number}.js"/>
548
+ </then>
549
+ </if>
550
+ </target>
551
+
552
+
553
+ <target name="-strip-console.log" description="(PRIVATE)Comments out any console.log statements">
554
+ <echo message="Commenting out console.log lines"/>
555
+
556
+
557
+ <replaceregexp match="(console.log\(.*\))" replace="/\*\1\*/" flags="g" >
558
+ <fileset dir="./${dir.publish}/${dir.js}/">
559
+ <include name="**/*.js"/>
560
+ <exclude name="**/*.min.js"/>
561
+ </fileset>
562
+ </replaceregexp>
563
+ </target>
564
+
565
+
566
+ <!-- HTML -->
567
+ <target name="-usemin" depends="-serverconfig" description="(PRIVATE) Replaces references to non-minified scripts">
568
+ <echo message="Switching to minified js files..."/>
569
+
570
+ <!-- switch from a regular jquery to minified -->
571
+ <replaceregexp match="jquery-(\d|\d(\.\d)+)\.js" replace="jquery-\1.min.js" flags="g">
572
+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
573
+ </replaceregexp>
574
+ <!-- switch any google CDN reference to minified -->
575
+ <replaceregexp match="(\d|\d(\.\d)+)\/jquery\.js" replace="\1/jquery.min.js" flags="g">
576
+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
577
+ </replaceregexp>
578
+
579
+ <echo>Kill off those versioning flags: ?v=2</echo>
580
+ <replaceregexp match='\?v=\d+">' replace='">' flags="g">
581
+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
582
+ </replaceregexp>
583
+
584
+ <echo>Remove favicon.ico reference if it is pointing to the root</echo>
585
+ <replaceregexp match="&lt;link rel=&quot;shortcut icon&quot; href=&quot;/favicon\.ico&quot;&gt;" replace="">
586
+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
587
+ </replaceregexp>
588
+ <!-- we maintain the apple-touch-icon reference for Android 2.2 www.ravelrumba.com/blog/android-apple-touch-icon
589
+ <replace token="&lt;link rel=&quot;apple-touch-icon&quot; href=&quot;/apple-touch-icon.png&quot;>" value="">
590
+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
591
+ </replace>
592
+ -->
593
+ </target>
594
+
595
+
596
+ <target name="-html" depends="-load-build-info" description="(PRIVATE) Very basic clean up of the HTML">
597
+ <echo message="Update the HTML to reference our concatenated script file: scripts-${build.number}.min.js"/>
598
+ <!-- style.css replacement handled as a replacetoken above -->
599
+ <replaceregexp match="&lt;!-- scripts concatenated [\d\w\s\W]*?!-- end ((scripts)|(concatenated and minified scripts))--&gt;" replace="&lt;script src='${dir.js}/scripts-${build.number}.min.js\'&gt;&lt;/script&gt;" flags="m">
600
+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
601
+ </replaceregexp>
602
+ <!--[! use comments like this one to avoid having them get minified -->
603
+ </target>
604
+
605
+
606
+ <target name="-htmlclean">
607
+ <echo message="Run htmlcompressor on the HTML"/>
608
+ <echo message=" - maintaining whitespace"/>
609
+ <echo message=" - removing html comments"/>
610
+ <echo message=" - compressing inline style/script tag contents"/>
611
+ <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
612
+ <fileset dir="./${dir.publish}/" includes="${page-files}"/>
613
+ <arg value="-jar"/>
614
+ <arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
615
+ <arg line="--type html"/>
616
+ <arg line="--preserve-multi-spaces"/>
617
+ <arg line="--remove-quotes"/>
618
+ <arg line="--compress-js"/>
619
+ <arg line="--compress-css"/>
620
+ <srcfile/>
621
+ <arg value="-o"/>
622
+ <mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
623
+ <targetfile/>
624
+ </apply>
625
+ </target>
626
+
627
+
628
+ <target name="-htmlbuildkit">
629
+ <echo message="Run htmlcompressor on the HTML"/>
630
+ <echo message=" - maintaining whitespace"/>
631
+ <echo message=" - retain html comments"/>
632
+ <echo message=" - compressing inline style/script tag contents"/>
633
+ <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
634
+ <fileset dir="./${dir.publish}/" includes="${page-files}"/>
635
+ <arg value="-jar"/>
636
+ <arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
637
+ <arg value="--preserve-comments"/>
638
+ <arg line="--preserve-multi-spaces"/>
639
+ <arg line="--type html"/>
640
+ <arg line="--compress-js"/>
641
+ <arg line="--compress-css"/>
642
+ <srcfile/>
643
+ <arg value="-o"/>
644
+ <mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
645
+ <targetfile/>
646
+ </apply>
647
+ </target>
648
+
649
+
650
+ <target name="-htmlcompress">
651
+ <echo message="Run htmlcompressor on the HTML"/>
652
+ <echo message=" - removing unnecessary whitespace"/>
653
+ <echo message=" - removing html comments"/>
654
+ <echo message=" - compressing inline style/script tag contents"/>
655
+ <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
656
+ <fileset dir="./${dir.publish}/" includes="${page-files}"/>
657
+ <arg value="-jar"/>
658
+ <arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
659
+ <arg line="--type html"/>
660
+ <arg line="--remove-quotes"/>
661
+ <arg line="--compress-js"/>
662
+ <arg line="--compress-css"/>
663
+ <srcfile/>
664
+ <arg value="-o"/>
665
+ <mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
666
+ <targetfile/>
667
+ </apply>
668
+ </target>
669
+
670
+
671
+ <target name="-serverconfig" description="(PRIVATE) Upgrades expires headers">
672
+ <echo message="Upgrading expires header timeouts for js/css to 1yr..."/>
673
+ <if>
674
+ <available file="./${dir.publish}/${file.serverconfig}"/>
675
+ <then>
676
+ <replace file="./${dir.publish}/${file.serverconfig}" token="access plus 2 months" value="access plus 1 year"/>
677
+ </then>
678
+ </if>
679
+ </target>
680
+
681
+
682
+ <!-- CSS -->
683
+ <target name="-css" depends="-load-build-info" description="Concatenates and Minifies any stylesheets listed in the file.stylesheets property">
684
+ <echo message="Concatenating css..."/>
685
+
686
+ <concat destfile="./${dir.publish}/${dir.css}/style-${build.number}.css">
687
+ <filelist dir="./${dir.publish}/${dir.css}" files="${stylesheet-files}"/>
688
+ </concat>
689
+
690
+ <echo message="Minifying css..."/>
691
+
692
+ <apply executable="java" parallel="false">
693
+ <fileset dir="./${dir.publish}/${dir.css}/" includes="style-${build.number}.css"/>
694
+ <arg line="-jar"/>
695
+ <arg path="./${dir.build.tools}/${tool.yuicompressor}"/>
696
+ <srcfile/>
697
+ <arg line="-o"/>
698
+ <mapper type="glob" from="style-${build.number}.css" to="../${dir.publish}/${dir.css}/style-${build.number}.min.css"/>
699
+ <targetfile/>
700
+ </apply>
701
+
702
+ <echo message="Updating the HTML with the new css filename"/>
703
+
704
+ <replace token="style.css" value="style-${build.number}.min.css" dir="${dir.publish}" includes="${page-files}"/>
705
+ </target>
706
+
707
+
708
+ <!-- IMAGES -->
709
+ <target name="-imagespng" description="(PRIVATE) Optimizes .png images using optipng">
710
+ <echo message="Optimizing images..."/>
711
+ <echo message="This part might take a while. But everything else is already done."/>
712
+ <echo message=" "/>
713
+
714
+
715
+ <echo message="First, we run optipng on the .png files..."/>
716
+
717
+ <!-- osfamily=unix is actually true on OS X as well -->
718
+ <!-- On *nix's and OS X, check for optipng and give a helpful message if it's not installed -->
719
+ <if>
720
+ <and>
721
+ <os family="unix" />
722
+ <available file="optipng" filepath="${ENV.PATH}" />
723
+ </and>
724
+ <then>
725
+ <apply executable="optipng" osfamily="unix">
726
+ <arg value="-quiet"/>
727
+ <arg value="-o7"/>
728
+ <fileset dir="./${dir.publish}/">
729
+ <include name="**/*.png"/>
730
+ </fileset>
731
+ </apply>
732
+ </then>
733
+ <elseif>
734
+ <os family="unix" />
735
+ <then>
736
+ <echo message="*** optipng NOT INSTALLED. SKIPPING OPTIMIZATION OF PNGs." />
737
+ <echo message="*** Install optipng to enable png optimization." />
738
+ <echo message="*** For instructions see 'Dependencies' at: http://html5boilerplate.com/docs/#Build-script#dependencies" />
739
+ </then>
740
+ </elseif>
741
+ </if>
742
+
743
+ <apply executable="tools/optipng-0.6.4-exe/optipng.exe" osfamily="windows">
744
+ <arg value="-o7"/>
745
+ <arg value="-quiet"/>
746
+ <fileset dir="./${dir.publish}/">
747
+ <include name="**/*.png"/>
748
+ </fileset>
749
+ </apply>
750
+ </target>
751
+
752
+
753
+ <target name="-imagesjpg" description="(PRIVATE) Optimizes .jpg images using jpegtan">
754
+ <echo message="Now, we clean up those jpgs..."/>
755
+
756
+ <!-- jpegtran is a little weird in that it assumes a pre-existing file means it's already optimized. -->
757
+ <!-- why? good question. To combat this, we skipped copying over the ${dir.images}/*.jpg earlier in the -->
758
+ <!-- copy task. Now, we're using jpegtran to copy the files over while we crunch 'em. -->
759
+
760
+ <if>
761
+ <equals arg1="${images.strip.metadata}" arg2="true"/>
762
+ <then>
763
+ <var name="strip-meta-tags" value="none"/>
764
+ </then>
765
+ <else>
766
+ <var name="strip-meta-tags" value="all"/>
767
+ </else>
768
+ </if>
769
+
770
+ <!-- On *nix's and OS X, check for jpegtran and give a helpful message if it's not installed -->
771
+ <if>
772
+ <and>
773
+ <os family="unix" />
774
+ <available file="jpegtran" filepath="${ENV.PATH}" />
775
+ </and>
776
+ <then>
777
+ <apply executable="jpegtran" osfamily="unix">
778
+ <fileset dir="${dir.source}/${dir.images}" includes="*.jpg"/>
779
+ <arg value="-copy"/>
780
+ <arg value="${strip-meta-tags}"/>
781
+ <arg value="-optimize"/>
782
+ <srcfile/>
783
+ <redirector>
784
+ <outputmapper type="glob" from="*.jpg" to="./${dir.publish}/${dir.images}/*.jpg"/>
785
+ </redirector>
786
+ <!-- you may want to flag optimized images. If so, do it here. Otherwise change this to type="identity" -->
787
+ </apply>
788
+ </then>
789
+ <elseif>
790
+ <os family="unix" />
791
+ <then>
792
+ <echo message="*** jpegtran NOT INSTALLED. SKIPPING OPTIMIZATION OF JPEGs." />
793
+ <echo message="*** Install jpegtran to enable jpeg optimization." />
794
+ <echo message="*** For instructions see 'Dependencies' at: http://html5boilerplate.com/docs/#Build-script#dependencies" />
795
+ </then>
796
+ </elseif>
797
+ </if>
798
+
799
+ <apply executable="tools/jpegtran.exe" osfamily="windows">
800
+ <fileset dir="${dir.source}/${dir.images}" includes="*.jpg"/>
801
+ <arg value="-copy"/>
802
+ <arg value="${strip-meta-tags}"/>
803
+ <arg value="-optimize"/>
804
+ <srcfile/>
805
+ <targetfile/>
806
+ <!-- you may want to flag optimized images. If so, do it here. Otherwise change this to type="identity" -->
807
+ <mapper type="glob" from="*.jpg" to="../${dir.publish}/${dir.images}/*.jpg"/>
808
+ </apply>
809
+ </target>
810
+
811
+
812
+ <target name="-jpgcopy">
813
+ <echo message="Copying over the unmodified jpegs."/>
814
+
815
+ <copy todir="./${dir.publish}/${dir.images}">
816
+ <fileset dir="${dir.source}/${dir.images}" includes="*.jpg"/>
817
+ </copy>
818
+ </target>
819
+
820
+
636
821
  </project>