html5-starter-mobile 0.1.2b

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/LICENSE +3 -0
  2. data/README.md +34 -0
  3. data/VERSION +1 -0
  4. data/lib/html5-boilerplate-mobile.rb +1 -0
  5. data/stylesheets/_html5-boilerplate-mobile.scss +13 -0
  6. data/stylesheets/html5-boilerplate-mobile/_fonts.scss +38 -0
  7. data/stylesheets/html5-boilerplate-mobile/_helpers.scss +49 -0
  8. data/stylesheets/html5-boilerplate-mobile/_reset.scss +48 -0
  9. data/stylesheets/html5-boilerplate-mobile/_styles.scss +83 -0
  10. data/templates/project/files/404.html +38 -0
  11. data/templates/project/files/build/build.xml +832 -0
  12. data/templates/project/files/build/config/buildinfo.properties +5 -0
  13. data/templates/project/files/build/config/default.properties +80 -0
  14. data/templates/project/files/build/config/project.properties +56 -0
  15. data/templates/project/files/build/createproject.sh +49 -0
  16. data/templates/project/files/build/runbuildscript.bat +5 -0
  17. data/templates/project/files/build/tools/ant-contrib-1.0b3.jar +0 -0
  18. data/templates/project/files/build/tools/htmlcompressor-1.1.jar +0 -0
  19. data/templates/project/files/build/tools/jpegtran.exe +0 -0
  20. data/templates/project/files/build/tools/optipng-0.6.4-exe/LICENSE.txt +21 -0
  21. data/templates/project/files/build/tools/optipng-0.6.4-exe/optipng.exe +0 -0
  22. data/templates/project/files/build/tools/yuicompressor-2.4.5.jar +0 -0
  23. data/templates/project/files/crossdomain.xml +25 -0
  24. data/templates/project/files/default.appcache +17 -0
  25. data/templates/project/files/favicon.ico +0 -0
  26. data/templates/project/files/gitignore.txt +38 -0
  27. data/templates/project/files/htaccess +493 -0
  28. data/templates/project/files/humans.txt +43 -0
  29. data/templates/project/files/robots.txt +5 -0
  30. data/templates/project/files/sitemap.xml +10 -0
  31. data/templates/project/files/tools/googleanalyticsformobile/Readme.PDF +0 -0
  32. data/templates/project/files/tools/googleanalyticsformobile/aspx/aspx1.snippet +31 -0
  33. data/templates/project/files/tools/googleanalyticsformobile/aspx/aspx2.snippet +2 -0
  34. data/templates/project/files/tools/googleanalyticsformobile/aspx/ga.aspx +195 -0
  35. data/templates/project/files/tools/googleanalyticsformobile/aspx/sample.aspx +44 -0
  36. data/templates/project/files/tools/googleanalyticsformobile/jsp/ga.jsp +225 -0
  37. data/templates/project/files/tools/googleanalyticsformobile/jsp/jsp1.snippet +35 -0
  38. data/templates/project/files/tools/googleanalyticsformobile/jsp/jsp2.snippet +2 -0
  39. data/templates/project/files/tools/googleanalyticsformobile/jsp/sample.jsp +51 -0
  40. data/templates/project/files/tools/googleanalyticsformobile/php/ga.php +176 -0
  41. data/templates/project/files/tools/googleanalyticsformobile/php/php1.snippet +30 -0
  42. data/templates/project/files/tools/googleanalyticsformobile/php/php2.snippet +4 -0
  43. data/templates/project/files/tools/googleanalyticsformobile/php/sample.php +44 -0
  44. data/templates/project/files/tools/googleanalyticsformobile/pl/ga.pl +195 -0
  45. data/templates/project/files/tools/googleanalyticsformobile/pl/perl1.snippet +27 -0
  46. data/templates/project/files/tools/googleanalyticsformobile/pl/perl2.snippet +1 -0
  47. data/templates/project/files/tools/googleanalyticsformobile/pl/sample.pl +38 -0
  48. data/templates/project/files/tools/mobile-bookmark-bubble/bookmark_bubble.js +559 -0
  49. data/templates/project/files/tools/mobile-bookmark-bubble/example/example.html +43 -0
  50. data/templates/project/files/tools/mobile-bookmark-bubble/example/example.js +57 -0
  51. data/templates/project/files/tools/mobile-bookmark-bubble/images/arrow.png +0 -0
  52. data/templates/project/files/tools/mobile-bookmark-bubble/images/close.png +0 -0
  53. data/templates/project/files/tools/mobile-bookmark-bubble/images/icon_calendar.png +0 -0
  54. data/templates/project/files/tools/wspl/databasefactory.js +45 -0
  55. data/templates/project/files/tools/wspl/dbworker.js +324 -0
  56. data/templates/project/files/tools/wspl/dbworker_test.html +393 -0
  57. data/templates/project/files/tools/wspl/dbworkerstarter.js +32 -0
  58. data/templates/project/files/tools/wspl/dbwrapper_gears.js +595 -0
  59. data/templates/project/files/tools/wspl/dbwrapper_gears_test.html +404 -0
  60. data/templates/project/files/tools/wspl/dbwrapper_html5.js +203 -0
  61. data/templates/project/files/tools/wspl/dbwrapper_html5_test.html +468 -0
  62. data/templates/project/files/tools/wspl/dbwrapperapi.js +202 -0
  63. data/templates/project/files/tools/wspl/dbwrapperapi_test.html +51 -0
  64. data/templates/project/files/tools/wspl/gears_resultset.js +71 -0
  65. data/templates/project/files/tools/wspl/gears_resultset_test.html +86 -0
  66. data/templates/project/files/tools/wspl/gears_transaction.js +196 -0
  67. data/templates/project/files/tools/wspl/gears_transaction_test.html +221 -0
  68. data/templates/project/files/tools/wspl/gearsutils.js +94 -0
  69. data/templates/project/files/tools/wspl/gearsutils_test.html +84 -0
  70. data/templates/project/files/tools/wspl/global_functions.js +72 -0
  71. data/templates/project/files/tools/wspl/simplenotes/index.html +347 -0
  72. data/templates/project/files/tools/wspl/simplenotes/simplenotes.js +503 -0
  73. data/templates/project/files/tools/wspl/simplenotes/styles.css +66 -0
  74. data/templates/project/files/tools/wspl/simplenotes/template.js +75 -0
  75. data/templates/project/images/h/apple-touch-icon.png +0 -0
  76. data/templates/project/images/h/splash.png +0 -0
  77. data/templates/project/images/l/apple-touch-icon-precomposed.png +0 -0
  78. data/templates/project/images/l/apple-touch-icon.png +0 -0
  79. data/templates/project/images/l/splash.png +0 -0
  80. data/templates/project/images/m/apple-touch-icon.png +0 -0
  81. data/templates/project/index.html +95 -0
  82. data/templates/project/javascripts/libs/jquery-1.5.2.js +8374 -0
  83. data/templates/project/javascripts/libs/jquery-1.5.2.min.js +16 -0
  84. data/templates/project/javascripts/libs/modernizr-custom.js +14 -0
  85. data/templates/project/javascripts/libs/respond.min.js +7 -0
  86. data/templates/project/javascripts/mylibs/helper.js +147 -0
  87. data/templates/project/javascripts/script.js +0 -0
  88. data/templates/project/manifest.rb +62 -0
  89. data/templates/project/partials/_boilerplate-defaults.scss +23 -0
  90. data/templates/project/style.scss +83 -0
  91. metadata +174 -0
data/LICENSE ADDED
@@ -0,0 +1,3 @@
1
+ Copyright (c) 2010 Peter Gumeson
2
+
3
+ http://creativecommons.org/licenses/by/3.0/
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ Compass Mobile HTML5 Starter
2
+ ============================
3
+
4
+ Mobile HTML5 Starter is a Compass extension based on [Mobile HTML5 Boilerplate](https://github.com/shichuan/mobile-html5-boilerplate) by Shi Chuan.
5
+ You can use it to kick-start a fully compliant mobile HTML5 applications. Generating a set of starter files for your mobile HTML5 projects with integrated Sass (Scss) templates.
6
+
7
+ Browse [html5boilerplate.com/mobile/](http://html5boilerplate.com/mobile/) for the full workup.
8
+
9
+
10
+ Installation
11
+ ============
12
+
13
+ gem install html5-starter-mobile
14
+
15
+
16
+ Starting a project
17
+ ------------------
18
+
19
+ compass create my_project -r html5-boilerplate-mobile -u html5-boilerplate-mobile --javascripts-dir assets/js --css-dir assets/css --images-dir assets/img --sass-dir assets/sass
20
+
21
+ The `--javascripts-dir`, `--css-dir`, `--images-dir` and `--sass-dir` flags are required to keep consistent with the original Mobile HTML5 Boilerplate project layout. If you omit them, be sure to edit your javascript and style tags accordingly in `index.html`.
22
+
23
+ Run `compass watch my_project` and the SCSS files will automatically get compiled to your Sass compilation directory whenever a change is made:
24
+
25
+ assets/css/style.css
26
+ assets/css/handheld.css
27
+
28
+ To see the complete list of files generated by this extension, see the [Mobile HTML5 Boilerplate](https://github.com/shichuan/mobile-html5-boilerplate) project repo.
29
+
30
+
31
+ Integrating with Blueprint
32
+ --------------------------
33
+
34
+ If you're planning to use the [Blueprint](http://compass-style.org/docs/reference/blueprint/) extension from Compass, you should remove the reset and font styles (see: line 19 and 20) inside the `style.scss` file. Blueprint already includes a reset and some basic typographic styles.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.6
@@ -0,0 +1 @@
1
+ Compass::Frameworks.register("html5-boilerplate-mobile", :path => "#{File.dirname(__FILE__)}/..")
@@ -0,0 +1,13 @@
1
+ @import "compass/css3";
2
+
3
+ @import "html5-boilerplate-mobile/reset";
4
+ @import "html5-boilerplate-mobile/fonts";
5
+ @import "html5-boilerplate-mobile/styles";
6
+ @import "html5-boilerplate-mobile/helpers";
7
+
8
+ @mixin html5-boilerplate-mobile {
9
+ @include html5-boilerplate-mobile-reset;
10
+ @include html5-boilerplate-mobile-fonts;
11
+ @include html5-boilerplate-mobile-styles;
12
+ @include html5-boilerplate-mobile-helpers;
13
+ }
@@ -0,0 +1,38 @@
1
+ $base-font-family: unquote("sans-serif") !default;
2
+ $base-font-size: 13px !default;
3
+ $base-line-height: 1.231 !default;
4
+
5
+ @mixin html5-boilerplate-mobile-fonts($family: $base-font-family, $size: $base-font-size, $line-height: $base-line-height) {
6
+ /**
7
+ * Font normalization inspired by YUI Library's fonts.css: developer.yahoo.com/yui/
8
+ */
9
+
10
+ body {
11
+ font-size: $size;
12
+ font-family: $family;
13
+ line-height: $line-height;
14
+ *font-size: small;
15
+ } /* Hack retained to preserve specificity */
16
+ select, input, textarea, button { font:99% $family; }
17
+
18
+ /* Normalize monospace sizing:
19
+ en.wikipedia.org/wiki/MediaWiki_talk:Common.css/Archive_11#Teletype_style_fix_for_Chrome */
20
+ pre, code, kbd, samp { font-family: monospace, sans-serif; }
21
+ }
22
+
23
+ // Sets the font size specified in pixels using percents so that the base
24
+ // font size changes and 1em has the correct value. When nesting font size
25
+ // declarations, within the DOM tree, the base_font_size must be the parent's
26
+ // effective font-size in pixels.
27
+ // Usage Examples:
28
+ // .big
29
+ // +font-size(16px)
30
+ // .bigger
31
+ // +font-size(18px)
32
+ // .big .bigger
33
+ // +font-size(18px, 16px)
34
+ //
35
+ // For more information see the table found at http://developer.yahoo.com/yui/3/cssfonts/#fontsize
36
+ @mixin font-size($size, $base-font-size: $base-font-size) {
37
+ font-size: ceil(percentage($size / $base-font-size));
38
+ }
@@ -0,0 +1,49 @@
1
+ @mixin clearfix {
2
+ zoom: 1;
3
+
4
+ &:before, &:after { content: "\0020"; display: block; height: 0; overflow: hidden; }
5
+ &:after { clear: both; }
6
+ }
7
+
8
+ @mixin html5-boilerplate-mobile-helpers {
9
+ /**
10
+ * Non-semantic helper classes: please define your styles before this section.
11
+ */
12
+
13
+ /* prevent callout */
14
+ .nocallout {-webkit-touch-callout: none;}
15
+
16
+ /* Text overflow with ellipsis */
17
+ .ellipsis {
18
+ text-overflow: ellipsis;
19
+ overflow: hidden;
20
+ white-space: nowrap;
21
+ }
22
+
23
+ /* A hack for HTML5 contenteditable attribute on mobile */
24
+ textarea.contenteditable {-webkit-appearance: none;}
25
+
26
+ /* A workaround for S60 3.x and 5.0 devices which do not animated gif images if they have been set as display: none */
27
+ .gifhidden {position: absolute; left: -100%;}
28
+
29
+ /* For image replacement */
30
+ .ir { display: block; text-indent: -999em; overflow: hidden; background-repeat: no-repeat; text-align: left; direction: ltr; }
31
+
32
+ /* Hide for both screenreaders and browsers:
33
+ css-discuss.incutio.com/wiki/Screenreader_Visibility */
34
+ .hidden { display: none; visibility: hidden; }
35
+
36
+ /* Hide only visually, but have it available for screenreaders: by Jon Neal.
37
+ www.webaim.org/techniques/css/invisiblecontent/ & j.mp/visuallyhidden */
38
+ .visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
39
+ /* Extends the .visuallyhidden class to allow the element to be focusable when navigated to via the keyboard: drupal.org/node/897638 */
40
+ .visuallyhidden.focusable:active,
41
+ .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
42
+
43
+ /* Hide visually and from screenreaders, but maintain layout */
44
+ .invisible { visibility: hidden; }
45
+
46
+ /* The Magnificent Clearfix: Updated to prevent margin-collapsing on child elements.
47
+ j.mp/bestclearfix */
48
+ .clearfix { @include clearfix; }
49
+ }
@@ -0,0 +1,48 @@
1
+ @mixin html5-boilerplate-mobile-reset {
2
+ /**
3
+ * html5doctor.com Reset Stylesheet (Eric Meyer's Reset Reloaded + HTML5 baseline)
4
+ * v1.6.1 2010-09-17 | Authors: Eric Meyer & Richard Clark
5
+ * html5doctor.com/html-5-reset-stylesheet/
6
+ */
7
+
8
+ html, body, div, span, object, iframe,
9
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
10
+ abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp,
11
+ small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li,
12
+ fieldset, form, label, legend,
13
+ table, caption, tbody, tfoot, thead, tr, th, td,
14
+ article, aside, canvas, details, figcaption, figure,
15
+ footer, header, hgroup, menu, nav, section, summary,
16
+ time, mark, audio, video {
17
+ margin: 0;
18
+ padding: 0;
19
+ border: 0;
20
+ font-size: 100%;
21
+ font: inherit;
22
+ vertical-align: baseline;
23
+ }
24
+
25
+ article, aside, details, figcaption, figure,
26
+ footer, header, hgroup, menu, nav, section {
27
+ display: block;
28
+ }
29
+
30
+ blockquote, q { quotes: none; }
31
+
32
+ blockquote:before, blockquote:after,
33
+ q:before, q:after { content: ""; content: none; }
34
+
35
+ ins { background-color: #ff9; color: #000; text-decoration: none; }
36
+
37
+ mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; }
38
+
39
+ del { text-decoration: line-through; }
40
+
41
+ abbr[title], dfn[title] { border-bottom: 1px dotted; cursor: help; }
42
+
43
+ table { border-collapse: collapse; border-spacing: 0; }
44
+
45
+ hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
46
+
47
+ input, select { vertical-align: middle; }
48
+ }
@@ -0,0 +1,83 @@
1
+ $font-color: #444 !default; //looks better than black: twitter.com/H_FJ/statuses/11800719859
2
+ $link-color: #607890 !default;
3
+ $link-hover-color: #036 !default;
4
+ $link-active-color: #607890 !default;
5
+ $link-visited-color: #607890 !default;
6
+ $selected-font-color: #fff !default;
7
+ $selected-background-color: #ff5e99 !default;
8
+ $list-left-margin: 2em !default;
9
+
10
+
11
+ @mixin html5-boilerplate-mobile-styles {
12
+ /**
13
+ * Minimal base styles.
14
+ */
15
+
16
+ /* Prevent mobile zooming while remain desktop zooming: github.com/shichuan/mobile-html5-boilerplate/issues/closed#issue/14 */
17
+ html { -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
18
+
19
+ /* Accessible focus treatment: people.opera.com/patrickl/experiments/keyboard/test */
20
+ a:hover, a:active { outline: none; }
21
+
22
+ ul, ol { margin-left: 2em; }
23
+ ol { list-style-type: decimal; }
24
+
25
+ /* Remove margins for navigation lists */
26
+ nav ul, nav li { margin: 0; list-style:none; list-style-image: none; }
27
+
28
+ small { font-size: 85%; }
29
+ strong, th { font-weight: bold; }
30
+
31
+ td { vertical-align: top; }
32
+
33
+ /* Set sub, sup without affecting line-height: gist.github.com/413930 */
34
+ sub, sup { font-size: 75%; line-height: 0; position: relative; }
35
+ sup { top: -0.5em; }
36
+ sub { bottom: -0.25em; }
37
+
38
+ pre {
39
+ /* www.pathf.com/blogs/2008/05/formatting-quoted-code-in-blog-posts-css21-white-space-pre-wrap/ */
40
+ white-space: pre; white-space: pre-wrap; word-wrap: break-word;
41
+ padding: 15px;
42
+ }
43
+
44
+ textarea { overflow: auto; } /* www.sitepoint.com/blogs/2010/08/20/ie-remove-textarea-scrollbars/ */
45
+
46
+ .iem7 legend { margin-left: -7px; }
47
+
48
+ /* Align checkboxes, radios, text inputs with their label by: Thierry Koblentz tjkdesign.com/ez-css/css/base.css */
49
+ input[type="radio"] { vertical-align: text-bottom; }
50
+ input[type="checkbox"] { vertical-align: bottom; }
51
+ .iem7 input[type="checkbox"] { vertical-align: baseline; }
52
+
53
+ /* Hand cursor on clickable input elements */
54
+ label, input[type="button"], input[type="submit"], input[type="image"], button { cursor: pointer; }
55
+
56
+ /* Webkit browsers add a 2px margin outside the chrome of form elements */
57
+ button, input, select, textarea { margin: 0; }
58
+
59
+ /* Colors for form validity */
60
+ input:valid, textarea:valid { }
61
+ input:invalid, textarea:invalid {
62
+ border-radius: 1px; -moz-box-shadow: 0px 0px 5px red; -webkit-box-shadow: 0px 0px 5px red; box-shadow: 0px 0px 5px red;
63
+ }
64
+ .no-boxshadow input:invalid, .no-boxshadow textarea:invalid { background-color: #f0dddd; }
65
+
66
+
67
+ /* These selection declarations have to be separate
68
+ No text-shadow: twitter.com/miketaylr/status/12228805301
69
+ Also: hot pink! */
70
+ ::-moz-selection{ background: $selected-background-color; color: $selected-font-color; text-shadow: none; }
71
+ ::selection { background: $selected-background-color; color: $selected-font-color; text-shadow: none; }
72
+
73
+ /* j.mp/webkit-tap-highlight-color */
74
+ a:link { -webkit-tap-highlight-color: $selected-background-color; }
75
+
76
+ /* Make buttons play nice in IE:
77
+ www.viget.com/inspire/styling-the-button-element-in-internet-explorer/ */
78
+ button { width: auto; overflow: visible; }
79
+
80
+ /* Bicubic resizing for non-native sized IMG:
81
+ code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/ */
82
+ .iem7 img { -ms-interpolation-mode: bicubic; }
83
+ }
@@ -0,0 +1,38 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Page Not Found :(</title>
6
+ <style>
7
+ body { text-align: center;}
8
+ h1 { font-size: 50px; text-align: center }
9
+ span[frown] { transform: rotate(90deg); display:inline-block; color: #bbb; }
10
+ body { font: 20px Constantia, 'Hoefler Text', "Adobe Caslon Pro", Baskerville, Georgia, Times, serif; color: #999; text-shadow: 2px 2px 2px rgba(200, 200, 200, 0.5); }
11
+ ::-moz-selection{ background:#FF5E99; color:#fff; }
12
+ ::selection { background:#FF5E99; color:#fff; }
13
+ article {display:block; text-align: left; width: 500px; margin: 0 auto; }
14
+
15
+ a { color: rgb(36, 109, 56); text-decoration:none; }
16
+ a:hover { color: rgb(96, 73, 141) ; text-shadow: 2px 2px 2px rgba(36, 109, 56, 0.5); }
17
+ </style>
18
+ </head>
19
+ <body>
20
+ <article>
21
+ <h1>Not found <span frown>:(</span></h1>
22
+ <div>
23
+ <p>Sorry, but the page you were trying to view does not exist.</p>
24
+ <p>It looks like this was the result of either:</p>
25
+ <ul>
26
+ <li>a mistyped address</li>
27
+ <li>an out-of-date link</li>
28
+ </ul>
29
+ </div>
30
+
31
+ <script>
32
+ var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),
33
+ GOOG_FIXURL_SITE = location.host;
34
+ </script>
35
+ <script src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
36
+ </article>
37
+ </body>
38
+ </html>
@@ -0,0 +1,832 @@
1
+ <?xml version="1.0"?>
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
+ <!-- load shell environment -->
14
+ <property environment="ENV" />
15
+
16
+ <!-- load property files -->
17
+ <property file="build/config/project.properties"/>
18
+ <property file="build/config/default.properties"/>
19
+
20
+ <!-- merge the stylesheet properties -->
21
+ <var name="stylesheet-files" value="${file.default.stylesheets}, ${file.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
+ -manifest"/>
229
+
230
+ <target name="-text.production"
231
+ depends="-rev,
232
+ -clean,
233
+ -copy,
234
+ -usemin,
235
+ -js.all.minify,
236
+ -js.main.concat,
237
+ -js.mylibs.concat,
238
+ -js.scripts.concat,
239
+ -js.delete,
240
+ -strip-console.log,
241
+ -css,
242
+ -html,
243
+ -htmlclean,
244
+ -manifest"/>
245
+
246
+ <!-- Target: buildkit -->
247
+ <target name="-buildkit.dev"
248
+ depends="-rev,
249
+ -clean,
250
+ -prodcopy,
251
+ -imagespng,
252
+ -imagesjpg"/>
253
+
254
+ <target name="-buildkit.test"
255
+ depends="-rev,
256
+ -clean,
257
+ -prodcopy,
258
+ -usemin,
259
+ -js.all.minify,
260
+ -js.main.concat,
261
+ -js.mylibs.concat,
262
+ -js.scripts.concat,
263
+ -js.delete,
264
+ -css,
265
+ -html,
266
+ -htmlbuildkit,
267
+ -imagespng,
268
+ -imagesjpg,
269
+ -manifest"/>
270
+
271
+ <target name="-buildkit.production"
272
+ depends="-rev,
273
+ -clean,
274
+ -prodcopy,
275
+ -usemin,
276
+ -js.all.minify,
277
+ -js.main.concat,
278
+ -js.mylibs.concat,
279
+ -js.scripts.concat,
280
+ -js.delete,
281
+ -strip-console.log,
282
+ -css,
283
+ -html,
284
+ -htmlbuildkit,
285
+ -imagespng,
286
+ -imagesjpg,
287
+ -manifest"/>
288
+
289
+ <!-- Target: build -->
290
+ <target name="-build.dev"
291
+ depends="-rev,
292
+ -clean,
293
+ -prodcopy,
294
+ -imagespng,
295
+ -imagesjpg"/>
296
+
297
+ <target name="-build.test"
298
+ depends="-rev,
299
+ -clean,
300
+ -prodcopy,
301
+ -usemin,
302
+ -js.all.minify,
303
+ -js.main.concat,
304
+ -js.mylibs.concat,
305
+ -js.scripts.concat,
306
+ -js.delete,
307
+ -css,
308
+ -html,
309
+ -htmlclean,
310
+ -imagespng,
311
+ -imagesjpg,
312
+ -manifest"/>
313
+
314
+ <target name="-build.production"
315
+ depends="-rev,
316
+ -clean,
317
+ -prodcopy,
318
+ -usemin,
319
+ -js.all.minify,
320
+ -js.main.concat,
321
+ -js.mylibs.concat,
322
+ -js.scripts.concat,
323
+ -js.delete,
324
+ -strip-console.log,
325
+ -css,
326
+ -html,
327
+ -htmlclean,
328
+ -imagespng,
329
+ -imagesjpg,
330
+ -manifest"/>
331
+
332
+ <!-- Target: minify -->
333
+ <target name="-minify.dev"
334
+ depends="-rev,
335
+ -clean,
336
+ -prodcopy,
337
+ -imagespng,
338
+ -imagesjpg"/>
339
+
340
+ <target name="-minify.test"
341
+ depends="-rev,
342
+ -clean,
343
+ -prodcopy,
344
+ -usemin,
345
+ -js.all.minify,
346
+ -js.main.concat,
347
+ -js.mylibs.concat,
348
+ -js.scripts.concat,
349
+ -js.delete,
350
+ -css,
351
+ -html,
352
+ -htmlcompress,
353
+ -imagespng,
354
+ -imagesjpg,
355
+ -manifest"/>
356
+
357
+ <target name="-minify.production"
358
+ depends="-rev,
359
+ -clean,
360
+ -prodcopy,
361
+ -usemin,
362
+ -js.all.minify,
363
+ -js.main.concat,
364
+ -js.mylibs.concat,
365
+ -js.scripts.concat,
366
+ -js.delete,
367
+ -strip-console.log,
368
+ -css,
369
+ -html,
370
+ -htmlcompress,
371
+ -imagespng,
372
+ -imagesjpg,
373
+ -manifest"/>
374
+
375
+ <!--
376
+ *************************************************
377
+ * FUNCTION TARGETS *
378
+ *************************************************
379
+ -->
380
+ <target name="-load-build-info" description="(PRIVATE) Loads the build versioning information">
381
+ <property file="./${dir.build}/config/${build.version.info}"/>
382
+ </target>
383
+
384
+ <target name="-clean" description="(PRIVATE) Wipe the previous build (Deletes the dir.publish directory">
385
+ <!-- This is a private target -->
386
+
387
+ <echo message="Cleaning up previous build directory..."/>
388
+ <delete dir="./${dir.publish}/"/>
389
+ </target>
390
+
391
+
392
+ <target name="-rev" description="(PRIVATE) Increase the current build number by one and set build date">
393
+ <!-- This is a private target -->
394
+
395
+ <echo message="====================================================================="/>
396
+ <echo message="Welcome to the HTML5 Boilerplate Build Script!"/>
397
+ <echo message=" "/>
398
+ <echo message="We're going to get your site all ship-shape and ready for prime time."/>
399
+ <echo message=" "/>
400
+ <echo message="This should take somewhere between 15 seconds and a few minutes,"/>
401
+ <echo message="mostly depending on how many images we're going to compress."/>
402
+ <echo message=" "/>
403
+ <echo message="Feel free to come back or stay here and follow along."/>
404
+ <echo message="====================================================================="/>
405
+ <echo message=" "/>
406
+ <echo message=" "/>
407
+
408
+
409
+ <echo message="Increasing the build number..."/>
410
+ <propertyfile file="./${dir.build}/config/${build.version.info}" comment="Build Information File - DO NOT CHANGE">
411
+ <entry key="build.number" type="int" default="0000" operation="+" pattern="0000"/>
412
+ <entry key="build.date" type="date" value="now" pattern="dd.MM.yyyy HH:mm"/>
413
+ </propertyfile>
414
+ <property file="./${dir.build}/config/${build.version.info}"/>
415
+ <echo>Creating build ${build.number}</echo>
416
+ </target>
417
+
418
+
419
+ <target name="current-number" depends="-load-build-info" description="(PUBLIC) Returns the current build number">
420
+ <echo>Current build number: ${build.number}</echo>
421
+ </target>
422
+
423
+
424
+ <target name="-copy" depends="-load-build-info">
425
+ <!-- This is a private target -->
426
+
427
+ <echo message="Copying over new files..."/>
428
+ <!-- combine the 2 exclude properties -->
429
+ <var name="excluded-files" value="${file.default.exclude}, ${file.exclude}"/>
430
+
431
+ <copy todir="./${dir.publish}">
432
+ <fileset dir="${dir.source}/" excludes="${excluded-files}"/>
433
+ </copy>
434
+
435
+ <echo message="A copy of all non-dev files are now in: ./${dir.publish}."/>
436
+ </target>
437
+
438
+ <target name="-prodcopy" depends="-load-build-info">
439
+ <!-- This is a private target -->
440
+
441
+ <echo message="Copying over new files..."/>
442
+ <!-- combine the 2 exclude properties -->
443
+ <var name="prod-excluded-files" value="${file.default.exclude}, ${file.jpg.exclude}, ${file.exclude}"/>
444
+
445
+ <copy todir="./${dir.publish}">
446
+ <fileset dir="${dir.source}/" excludes="${prod-excluded-files}"/>
447
+ </copy>
448
+
449
+ <echo message="A copy of all non-dev files are now in: ./${dir.publish}."/>
450
+ </target>
451
+
452
+
453
+ <!-- JAVASCRIPT -->
454
+ <target name="-js.main.concat" depends="-load-build-info" description="(PRIVATE) Concatenates the JS files in dir.js">
455
+ <echo message="Concatenating Main JS scripts..."/>
456
+ <concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}.js">
457
+ <fileset dir="./${dir.publish}/">
458
+ <include name="**/${dir.js.main}/*.min.js"/>
459
+ <exclude name="**/${dir.js.mylibs}/*.js"/>
460
+ <exclude name="**/${dir.js.libs}/*.js"/>
461
+ </fileset>
462
+ </concat>
463
+ </target>
464
+
465
+
466
+ <target name="-js.mylibs.concat" depends="-load-build-info" description="(PRIVATE) Concatenates the JS files in dir.js.mylibs">
467
+ <echo message="Concatenating JS libraries"/>
468
+ <concat destfile="./${dir.publish}/${dir.js}/libs-${build.number}.js">
469
+ <fileset dir="./${dir.publish}/${dir.js.mylibs}/">
470
+ <include name="**/*.min.js"/>
471
+ </fileset>
472
+ </concat>
473
+ </target>
474
+
475
+
476
+ <target name="-js.scripts.concat" depends="-load-build-info" if="build.concat.scripts">
477
+ <echo message="Concatenating library file with main script file"/>
478
+ <concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}.min.js">
479
+ <fileset dir="./${dir.publish}/${dir.js}/">
480
+ <include name="libs-${build.number}.js"/>
481
+ <include name="scripts-${build.number}.js"/>
482
+ </fileset>
483
+ </concat>
484
+
485
+ <echo message="Concatenating library file with main debug script file"/>
486
+ <concat destfile="./${dir.publish}/${dir.js}/scripts-${build.number}-debug.min.js">
487
+ <fileset dir="./${dir.publish}/${dir.js}/">
488
+ <include name="libs-${build.number}.js"/>
489
+ <include name="scripts-${build.number}-debug.js"/>
490
+ </fileset>
491
+ </concat>
492
+ </target>
493
+
494
+
495
+ <target name="-js.all.minify" depends="-js.libs.minify" description="(PRIVATE) Minifies the scripts.js files created by js.scripts.concat">
496
+ <echo message="Minifying concatenated script- and library-file"/>
497
+ <apply executable="java" parallel="false">
498
+ <fileset dir="./${dir.publish}/${dir.js}">
499
+ <include name="**/*.js"/>
500
+ <exclude name="**/*.min.js"/>
501
+ <exclude name="**/${dir.js.libs}/*.js"/>
502
+ </fileset>
503
+ <arg line="-jar"/>
504
+ <arg path="./${dir.build.tools}/${tool.yuicompressor}"/>
505
+ <srcfile/>
506
+ <arg line="--line-break"/>
507
+ <arg line="4000"/>
508
+ <arg line="-o"/>
509
+ <mapper type="glob" from="*.js" to="../${dir.publish}/${dir.js}/*.min.js"/>
510
+ <targetfile/>
511
+ </apply>
512
+ </target>
513
+
514
+
515
+ <target name="-js.libs.minify" depends="-load-build-info" description="(PRIVATE) Minifies the helper files in dir.js.libs">
516
+ <echo message="Minifying helper JS files..."/>
517
+
518
+ <apply executable="java" parallel="false">
519
+ <fileset dir="./${dir.publish}/${dir.js.libs}/" includes="*.js" excludes="*.min.js"/>
520
+ <arg line="-jar"/>
521
+ <arg path="./${dir.build.tools}/${tool.yuicompressor}"/>
522
+ <srcfile/>
523
+ <arg line="-o"/>
524
+ <mapper type="glob" from="*.js" to="../${dir.publish}/${dir.js.libs}/*-${build.number}.min.js"/>
525
+ <targetfile/>
526
+ </apply>
527
+ </target>
528
+
529
+
530
+ <target name="-js.delete" depends="-load-build-info" description="(PRIVATE) Deletes the unoptimized js files from build if set">
531
+ <if>
532
+ <equals arg1="${build.delete.unoptimized}" arg2="true"/>
533
+ <then>
534
+ <echo message="Deleting unoptimized files..."/>
535
+ <delete file="./${dir.publish}/${dir.js}/scripts-${build.number}.js"/>
536
+ <delete file="./${dir.publish}/${dir.js}/scripts-${build.number}-debug.js"/>
537
+ <!--
538
+ <delete dir="./${dir.publish}/${dir.js.lib}/"/>
539
+ <delete file="./${dir.publish}/${dir.js}/libs-${build.number}.js"/>
540
+ this guy probably COULD be on but I think it's better if we keep him off for now. ^pi
541
+ <delete includeemptydirs="true">
542
+ <fileset dir="./${dir.publish}/${dir.js.libs}/" includes="*.js" excludes="*.min.js"/>
543
+ </delete>
544
+ -->
545
+ </then>
546
+ </if>
547
+
548
+ <if>
549
+ <and>
550
+ <equals arg1="${build.delete.unoptimized}" arg2="true"/>
551
+ <equals arg1="${build.concat.scripts}" arg2="true"/>
552
+ </and>
553
+ <then>
554
+ <delete file="./${dir.publish}/${dir.js}/libs-${build.number}.js"/>
555
+ <delete file="./${dir.publish}/${dir.js}/scripts-${build.number}.js"/>
556
+ </then>
557
+ </if>
558
+ </target>
559
+
560
+
561
+ <target name="-strip-console.log" description="(PRIVATE)Comments out any console.log statements">
562
+ <echo message="Commenting out console.log lines"/>
563
+
564
+
565
+ <replaceregexp match="(console.log\(.*\))" replace="/\*\1\*/" flags="g" >
566
+ <fileset dir="./${dir.publish}/${dir.js}/">
567
+ <include name="**/*.js"/>
568
+ <exclude name="**/*.min.js"/>
569
+ </fileset>
570
+ </replaceregexp>
571
+ </target>
572
+
573
+
574
+ <!-- HTML -->
575
+ <target name="-usemin" depends="-serverconfig" description="(PRIVATE) Replaces references to non-minified scripts">
576
+ <echo message="Switching to minified js files..."/>
577
+
578
+ <!-- switch from a regular jquery to minified -->
579
+ <replaceregexp match="jquery-(\d|\d(\.\d)+)\.js" replace="jquery-\1.min.js" flags="g">
580
+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
581
+ </replaceregexp>
582
+ <!-- switch any google CDN reference to minified -->
583
+ <replaceregexp match="(\d|\d(\.\d)+)\/jquery\.js" replace="\1/jquery.min.js" flags="g">
584
+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
585
+ </replaceregexp>
586
+
587
+ <echo>Kill off those versioning flags: ?v=2</echo>
588
+ <replaceregexp match='\?v=\d+">' replace='">' flags="g">
589
+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
590
+ </replaceregexp>
591
+
592
+ <echo>Remove favicon.ico reference if it is pointing to the root</echo>
593
+ <replaceregexp match="&lt;link rel=&quot;shortcut icon&quot; href=&quot;/favicon\.ico&quot;&gt;" replace="">
594
+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
595
+ </replaceregexp>
596
+ <!-- we maintain the apple-touch-icon reference for Android 2.2 www.ravelrumba.com/blog/android-apple-touch-icon
597
+ <replace token="&lt;link rel=&quot;apple-touch-icon&quot; href=&quot;/apple-touch-icon.png&quot;>" value="">
598
+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
599
+ </replace>
600
+ -->
601
+ </target>
602
+
603
+
604
+ <target name="-html" depends="-load-build-info" description="(PRIVATE) Very basic clean up of the HTML">
605
+ <echo message="Update the HTML to reference our concatenated script file: scripts-${build.number}.min.js"/>
606
+ <!-- style.css replacement handled as a replacetoken above -->
607
+ <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">
608
+ <fileset dir="./${dir.publish}" includes="${page-files}"/>
609
+ </replaceregexp>
610
+ <!--[! use comments like this one to avoid having them get minified -->
611
+ </target>
612
+
613
+
614
+ <target name="-htmlclean">
615
+ <echo message="Run htmlcompressor on the HTML"/>
616
+ <echo message=" - maintaining whitespace"/>
617
+ <echo message=" - removing html comments"/>
618
+ <echo message=" - compressing inline style/script tag contents"/>
619
+ <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
620
+ <fileset dir="./${dir.publish}/" includes="${page-files}"/>
621
+ <arg value="-jar"/>
622
+ <arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
623
+ <arg line="--type html"/>
624
+ <arg line="--preserve-multi-spaces"/>
625
+ <arg line="--remove-quotes"/>
626
+ <arg line="--compress-js"/>
627
+ <arg line="--compress-css"/>
628
+ <srcfile/>
629
+ <arg value="-o"/>
630
+ <mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
631
+ <targetfile/>
632
+ </apply>
633
+ </target>
634
+
635
+
636
+ <target name="-htmlbuildkit">
637
+ <echo message="Run htmlcompressor on the HTML"/>
638
+ <echo message=" - maintaining whitespace"/>
639
+ <echo message=" - retain html comments"/>
640
+ <echo message=" - compressing inline style/script tag contents"/>
641
+ <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
642
+ <fileset dir="./${dir.publish}/" includes="${page-files}"/>
643
+ <arg value="-jar"/>
644
+ <arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
645
+ <arg value="--preserve-comments"/>
646
+ <arg line="--preserve-multi-spaces"/>
647
+ <arg line="--type html"/>
648
+ <arg line="--compress-js"/>
649
+ <arg line="--compress-css"/>
650
+ <srcfile/>
651
+ <arg value="-o"/>
652
+ <mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
653
+ <targetfile/>
654
+ </apply>
655
+ </target>
656
+
657
+
658
+ <target name="-htmlcompress">
659
+ <echo message="Run htmlcompressor on the HTML"/>
660
+ <echo message=" - removing unnecessary whitespace"/>
661
+ <echo message=" - removing html comments"/>
662
+ <echo message=" - compressing inline style/script tag contents"/>
663
+ <apply executable="java" parallel="false" force="true" dest="./${dir.publish}/" >
664
+ <fileset dir="./${dir.publish}/" includes="${page-files}"/>
665
+ <arg value="-jar"/>
666
+ <arg path="./${dir.build}/tools/${tool.htmlcompressor}"/>
667
+ <arg line="--type html"/>
668
+ <arg line="--remove-quotes"/>
669
+ <arg line="--compress-js"/>
670
+ <arg line="--compress-css"/>
671
+ <srcfile/>
672
+ <arg value="-o"/>
673
+ <mapper type="glob" from="*.html" to="../${dir.publish}/*.html"/>
674
+ <targetfile/>
675
+ </apply>
676
+ </target>
677
+
678
+
679
+ <target name="-serverconfig" description="(PRIVATE) Upgrades expires headers">
680
+ <echo message="Upgrading expires header timeouts for js/css to 1yr..."/>
681
+ <replace file="./${dir.publish}/${file.serverconfig}" token="access plus 2 months" value="access plus 1 year"/>
682
+ </target>
683
+
684
+
685
+ <target name="-manifest">
686
+ <replace>
687
+ <replacefilter token="default.appcache" value="default-${build.number}.appcache" />
688
+ <fileset dir="./${dir.publish}/" includes="${page-files}"/>
689
+ </replace>
690
+ <move file="./${dir.publish}/default.appcache" tofile="./${dir.publish}/default-${build.number}.appcache"/>
691
+ </target>
692
+
693
+ <!-- CSS -->
694
+ <target name="-css" depends="-load-build-info" description="Concatenates and Minifies any stylesheets listed in the file.stylesheets property">
695
+ <echo message="Concatenating css..."/>
696
+
697
+ <concat destfile="./${dir.publish}/${dir.css}/style-${build.number}.css">
698
+ <filelist dir="./${dir.publish}/${dir.css}" files="${stylesheet-files}"/>
699
+ </concat>
700
+
701
+ <echo message="Minifying css..."/>
702
+
703
+ <apply executable="java" parallel="false">
704
+ <fileset dir="./${dir.publish}/${dir.css}/" includes="style-${build.number}.css"/>
705
+ <arg line="-jar"/>
706
+ <arg path="./${dir.build.tools}/${tool.yuicompressor}"/>
707
+ <srcfile/>
708
+ <arg line="-o"/>
709
+ <mapper type="glob" from="style-${build.number}.css" to="../${dir.publish}/${dir.css}/style-${build.number}.min.css"/>
710
+ <targetfile/>
711
+ </apply>
712
+
713
+ <echo message="Updating the HTML with the new css filename"/>
714
+
715
+ <replace token="style.css" value="style-${build.number}.min.css" dir="${dir.publish}" includes="${page-files}"/>
716
+ </target>
717
+
718
+
719
+ <!-- IMAGES -->
720
+ <target name="-imagespng" description="(PRIVATE) Optimizes .png images using optipng">
721
+ <echo message="Optimizing images..."/>
722
+ <echo message="This part might take a while. But everything else is already done."/>
723
+ <echo message=" "/>
724
+
725
+
726
+ <echo message="First, we run optipng on the .png files..."/>
727
+
728
+ <!-- osfamily=unix is actually true on OS X as well -->
729
+ <!-- On *nix's and OS X, check for optipng and give a helpful message if it's not installed -->
730
+ <if>
731
+ <and>
732
+ <os family="unix" />
733
+ <available file="optipng" filepath="${ENV.PATH}" />
734
+ </and>
735
+ <then>
736
+ <apply executable="optipng" osfamily="unix">
737
+ <arg value="-quiet"/>
738
+ <arg value="-o7"/>
739
+ <fileset dir="./${dir.publish}/">
740
+ <include name="**/*.png"/>
741
+ </fileset>
742
+ </apply>
743
+ </then>
744
+ <elseif>
745
+ <os family="unix" />
746
+ <then>
747
+ <echo message="*** optipng NOT INSTALLED. SKIPPING OPTIMIZATION OF PNGs." />
748
+ <echo message="*** Install optipng to enable png optimization." />
749
+ <echo message="*** For instructions see 'Dependencies' at: http://html5boilerplate.com/docs/#Build-script#dependencies" />
750
+ </then>
751
+ </elseif>
752
+ </if>
753
+
754
+ <apply executable="tools/optipng-0.6.4-exe/optipng.exe" osfamily="windows">
755
+ <arg value="-o7"/>
756
+ <arg value="-quiet"/>
757
+ <fileset dir="./${dir.publish}/">
758
+ <include name="**/*.png"/>
759
+ </fileset>
760
+ </apply>
761
+ </target>
762
+
763
+
764
+ <target name="-imagesjpg" description="(PRIVATE) Optimizes .jpg images using jpegtan">
765
+ <echo message="Now, we clean up those jpgs..."/>
766
+
767
+ <!-- jpegtran is a little weird in that it assumes a pre-existing file means it's already optimized. -->
768
+ <!-- why? good question. To combat this, we skipped copying over the ${dir.images}/*.jpg earlier in the -->
769
+ <!-- copy task. Now, we're using jpegtran to copy the files over while we crunch 'em. -->
770
+
771
+ <if>
772
+ <equals arg1="${images.strip.metadata}" arg2="true"/>
773
+ <then>
774
+ <var name="strip-meta-tags" value="none"/>
775
+ </then>
776
+ <else>
777
+ <var name="strip-meta-tags" value="all"/>
778
+ </else>
779
+ </if>
780
+
781
+ <!-- On *nix's and OS X, check for jpegtran and give a helpful message if it's not installed -->
782
+ <if>
783
+ <and>
784
+ <os family="unix" />
785
+ <available file="jpegtran" filepath="${ENV.PATH}" />
786
+ </and>
787
+ <then>
788
+ <apply executable="jpegtran" osfamily="unix">
789
+ <fileset dir="${dir.source}/${dir.images}" includes="*.jpg"/>
790
+ <arg value="-copy"/>
791
+ <arg value="${strip-meta-tags}"/>
792
+ <arg value="-optimize"/>
793
+ <srcfile/>
794
+ <redirector>
795
+ <outputmapper type="glob" from="*.jpg" to="./${dir.publish}/${dir.images}/*.jpg"/>
796
+ </redirector>
797
+ <!-- you may want to flag optimized images. If so, do it here. Otherwise change this to type="identity" -->
798
+ </apply>
799
+ </then>
800
+ <elseif>
801
+ <os family="unix" />
802
+ <then>
803
+ <echo message="*** jpegtran NOT INSTALLED. SKIPPING OPTIMIZATION OF JPEGs." />
804
+ <echo message="*** Install jpegtran to enable jpeg optimization." />
805
+ <echo message="*** For instructions see 'Dependencies' at: http://html5boilerplate.com/docs/#Build-script#dependencies" />
806
+ </then>
807
+ </elseif>
808
+ </if>
809
+
810
+ <apply executable="tools/jpegtran.exe" osfamily="windows">
811
+ <fileset dir="${dir.source}/${dir.images}" includes="*.jpg"/>
812
+ <arg value="-copy"/>
813
+ <arg value="${strip-meta-tags}"/>
814
+ <arg value="-optimize"/>
815
+ <srcfile/>
816
+ <targetfile/>
817
+ <!-- you may want to flag optimized images. If so, do it here. Otherwise change this to type="identity" -->
818
+ <mapper type="glob" from="*.jpg" to="../${dir.publish}/${dir.images}/*.jpg"/>
819
+ </apply>
820
+ </target>
821
+
822
+
823
+ <target name="-jpgcopy">
824
+ <echo message="Copying over the unmodified jpegs."/>
825
+
826
+ <copy todir="./${dir.publish}/${dir.images}">
827
+ <fileset dir="${dir.source}/${dir.images}" includes="*.jpg"/>
828
+ </copy>
829
+ </target>
830
+
831
+
832
+ </project>