|
245 | 245 | <target name="-buildkit.dev" |
246 | 246 | depends="-rev, |
247 | 247 | -clean, |
248 | | - -copy, |
| 248 | + -prodcopy, |
249 | 249 | -imagespng, |
250 | 250 | -imagesjpg"/> |
251 | 251 |
|
252 | 252 | <target name="-buildkit.test" |
253 | 253 | depends="-rev, |
254 | 254 | -clean, |
255 | | - -copy, |
| 255 | + -prodcopy, |
256 | 256 | -usemin, |
257 | 257 | -js.all.minify, |
258 | 258 | -js.main.concat, |
|
268 | 268 | <target name="-buildkit.production" |
269 | 269 | depends="-rev, |
270 | 270 | -clean, |
271 | | - -copy, |
| 271 | + -prodcopy, |
272 | 272 | -usemin, |
273 | 273 | -js.all.minify, |
274 | 274 | -js.main.concat, |
|
286 | 286 | <target name="-build.dev" |
287 | 287 | depends="-rev, |
288 | 288 | -clean, |
289 | | - -copy, |
| 289 | + -prodcopy, |
290 | 290 | -imagespng, |
291 | 291 | -imagesjpg"/> |
292 | 292 |
|
293 | 293 | <target name="-build.test" |
294 | 294 | depends="-rev, |
295 | 295 | -clean, |
296 | | - -copy, |
| 296 | + -prodcopy, |
297 | 297 | -usemin, |
298 | 298 | -js.all.minify, |
299 | 299 | -js.main.concat, |
|
309 | 309 | <target name="-build.production" |
310 | 310 | depends="-rev, |
311 | 311 | -clean, |
312 | | - -copy, |
| 312 | + -prodcopy, |
313 | 313 | -usemin, |
314 | 314 | -js.all.minify, |
315 | 315 | -js.main.concat, |
|
327 | 327 | <target name="-minify.dev" |
328 | 328 | depends="-rev, |
329 | 329 | -clean, |
330 | | - -copy, |
| 330 | + -prodcopy, |
331 | 331 | -imagespng, |
332 | 332 | -imagesjpg"/> |
333 | 333 |
|
334 | 334 | <target name="-minify.test" |
335 | 335 | depends="-rev, |
336 | 336 | -clean, |
337 | | - -copy, |
| 337 | + -prodcopy, |
338 | 338 | -usemin, |
339 | 339 | -js.all.minify, |
340 | 340 | -js.main.concat, |
|
350 | 350 | <target name="-minify.production" |
351 | 351 | depends="-rev, |
352 | 352 | -clean, |
353 | | - -copy, |
| 353 | + -prodcopy, |
354 | 354 | -usemin, |
355 | 355 | -js.all.minify, |
356 | 356 | -js.main.concat, |
|
384 | 384 | <target name="-rev" description="(PRIVATE) Increase the current build number by one and set build date"> |
385 | 385 | <!-- This is a private target --> |
386 | 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 | + |
387 | 401 | <echo message="Increasing the build number..."/> |
388 | 402 | <propertyfile file="./${dir.build}/config/${build.version.info}" comment="Build Information File - DO NOT CHANGE"> |
389 | 403 | <entry key="build.number" type="int" default="0000" operation="+" pattern="0000"/> |
|
409 | 423 | <copy todir="./${dir.publish}"> |
410 | 424 | <fileset dir="${dir.source}/" excludes="${excluded-files}"/> |
411 | 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}."/> |
412 | 442 | </target> |
413 | 443 |
|
414 | 444 |
|
|
538 | 568 | <echo message="Switching to minified js files..."/> |
539 | 569 |
|
540 | 570 | <!-- switch from a regular jquery to minified --> |
541 | | - <replaceregexp match="jquery-(\d|\d(\.\d)+)\.js" replace="jquery-\1.min.js" flags=""> |
| 571 | + <replaceregexp match="jquery-(\d|\d(\.\d)+)\.js" replace="jquery-\1.min.js" flags="g"> |
542 | 572 | <fileset dir="./${dir.publish}" includes="${page-files}"/> |
543 | 573 | </replaceregexp> |
544 | 574 | <!-- switch any google CDN reference to minified --> |
545 | | - <replaceregexp match="(\d|\d(\.\d)+)\/jquery\.js" replace="\1/jquery.min.js" flags=""> |
| 575 | + <replaceregexp match="(\d|\d(\.\d)+)\/jquery\.js" replace="\1/jquery.min.js" flags="g"> |
546 | 576 | <fileset dir="./${dir.publish}" includes="${page-files}"/> |
547 | 577 | </replaceregexp> |
548 | 578 |
|
549 | | - <echo>kill off those versioning flags: ?v=2</echo> |
550 | | - <replaceregexp match='\?v=\d+">' replace='">' flags=""> |
| 579 | + <echo>Kill off those versioning flags: ?v=2</echo> |
| 580 | + <replaceregexp match='\?v=\d+">' replace='">' flags="g"> |
551 | 581 | <fileset dir="./${dir.publish}" includes="${page-files}"/> |
552 | 582 | </replaceregexp> |
553 | 583 |
|
554 | | - <echo>remove favicon reference if it is pointing to the root</echo> |
| 584 | + <echo>Remove favicon.ico reference if it is pointing to the root</echo> |
555 | 585 | <replaceregexp match="<link rel="shortcut icon" href="/favicon\.ico">" replace=""> |
556 | 586 | <fileset dir="./${dir.publish}" includes="${page-files}"/> |
557 | 587 | </replaceregexp> |
|
564 | 594 |
|
565 | 595 |
|
566 | 596 | <target name="-html" depends="-load-build-info" description="(PRIVATE) Very basic clean up of the HTML"> |
567 | | - <echo message="Clean up the html..."/> |
| 597 | + <echo message="Update the HTML to reference our concatenated script file: scripts-${build.number}.min.js"/> |
568 | 598 | <!-- style.css replacement handled as a replacetoken above --> |
569 | 599 | <replaceregexp match="<!-- scripts concatenated [\d\w\s\W]*?!-- end ((scripts)|(concatenated and minified scripts))-->" replace="<script src='${dir.js}/scripts-${build.number}.min.js\'></script>" flags="m"> |
570 | 600 | <fileset dir="./${dir.publish}" includes="${page-files}"/> |
|
574 | 604 |
|
575 | 605 |
|
576 | 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"/> |
577 | 611 | <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" > |
578 | 612 | <fileset dir="./${dir.publish}/" includes="${page-files}"/> |
579 | 613 | <arg value="-jar"/> |
|
592 | 626 |
|
593 | 627 |
|
594 | 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"/> |
595 | 633 | <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" > |
596 | 634 | <fileset dir="./${dir.publish}/" includes="${page-files}"/> |
597 | 635 | <arg value="-jar"/> |
|
610 | 648 |
|
611 | 649 |
|
612 | 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"/> |
613 | 655 | <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" > |
614 | 656 | <fileset dir="./${dir.publish}/" includes="${page-files}"/> |
615 | 657 | <arg value="-jar"/> |
|
627 | 669 |
|
628 | 670 |
|
629 | 671 | <target name="-serverconfig" description="(PRIVATE) Upgrades expires headers"> |
630 | | - <echo message="Upgrading expires header timeouts for js/css"/> |
| 672 | + <echo message="Upgrading expires header timeouts for js/css to 1yr..."/> |
631 | 673 | <replace file="./${dir.publish}/${file.serverconfig}" token="access plus 2 months" value="access plus 1 year"/> |
632 | 674 | </target> |
633 | 675 |
|
634 | 676 |
|
635 | 677 | <!-- CSS --> |
636 | 678 | <target name="-css" depends="-load-build-info" description="Concatenates and Minifies any stylesheets listed in the file.stylesheets property"> |
637 | | - <echo message="Minifying css..."/> |
| 679 | + <echo message="Concatenating css..."/> |
638 | 680 |
|
639 | 681 | <concat destfile="./${dir.publish}/${dir.css}/style-${build.number}.css"> |
640 | 682 | <filelist dir="./${dir.publish}/${dir.css}" files="${stylesheet-files}"/> |
641 | 683 | </concat> |
642 | | - <apply executable="php" parallel="false"> |
| 684 | + |
| 685 | + <echo message="Minifying css..."/> |
| 686 | + |
| 687 | + <apply executable="java" parallel="false"> |
643 | 688 | <fileset dir="./${dir.publish}/${dir.css}/" includes="style-${build.number}.css"/> |
644 | | - <arg line="-f"/> |
645 | | - <arg path="./${dir.build.tools}/${tool.csscompressor}"/> |
| 689 | + <arg line="-jar"/> |
| 690 | + <arg path="./${dir.build.tools}/${tool.yuicompressor}"/> |
646 | 691 | <srcfile/> |
647 | | - <redirector> |
648 | | - <outputmapper type="glob" from="style-${build.number}.css" to="./${dir.publish}/${dir.css}/style-${build.number}.min.css"/> |
649 | | - </redirector> |
| 692 | + <arg line="-o"/> |
| 693 | + <mapper type="glob" from="style-${build.number}.css" to="../${dir.publish}/${dir.css}/style-${build.number}.min.css"/> |
| 694 | + <targetfile/> |
650 | 695 | </apply> |
651 | 696 |
|
| 697 | + <echo message="Updating the HTML with the new css filename"/> |
| 698 | + |
652 | 699 | <replace token="style.css" value="style-${build.number}.min.css" dir="${dir.publish}" includes="${page-files}"/> |
653 | 700 | </target> |
654 | 701 |
|
655 | 702 |
|
656 | 703 | <!-- IMAGES --> |
657 | 704 | <target name="-imagespng" description="(PRIVATE) Optimizes .png images using optipng"> |
658 | 705 | <echo message="Optimizing images..."/> |
659 | | - <echo message="This part might take a while. But the rest of everything is already done."/> |
| 706 | + <echo message="This part might take a while. But everything else is already done."/> |
| 707 | + <echo message=" "/> |
| 708 | + |
| 709 | + |
660 | 710 | <echo message="First, we run optipng on the .png files..."/> |
661 | 711 |
|
662 | 712 | <!-- osfamily=unix is actually true on OS X as well --> |
|
720 | 770 | </and> |
721 | 771 | <then> |
722 | 772 | <apply executable="jpegtran" osfamily="unix"> |
723 | | - <fileset dir="./${dir.images}" includes="*.jpg"/> |
| 773 | + <fileset dir="${dir.source}/${dir.images}" includes="*.jpg"/> |
724 | 774 | <arg value="-copy"/> |
725 | 775 | <arg value="${strip-meta-tags}"/> |
726 | 776 | <arg value="-optimize"/> |
|
742 | 792 | </if> |
743 | 793 |
|
744 | 794 | <apply executable="tools/jpegtran.exe" osfamily="windows"> |
745 | | - <fileset dir="./${dir.images}" includes="*.jpg"/> |
| 795 | + <fileset dir="${dir.source}/${dir.images}" includes="*.jpg"/> |
746 | 796 | <arg value="-copy"/> |
747 | 797 | <arg value="${strip-meta-tags}"/> |
748 | 798 | <arg value="-optimize"/> |
|
0 commit comments