bixbite 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. data/LICENSE +20 -0
  2. data/README.markdown +49 -0
  3. data/VERSION +1 -0
  4. data/bin/bixbite +73 -0
  5. data/lib/bixbite.rb +13 -0
  6. data/lib/bixbite/command.rb +14 -0
  7. data/lib/bixbite/create.rb +76 -0
  8. data/template/Rakefile +25 -0
  9. data/template/assets/bixbite/Rakefile.rb +297 -0
  10. data/template/assets/naturaldocs/NaturalDocs/Config/Languages.txt +286 -0
  11. data/template/assets/naturaldocs/NaturalDocs/Config/Topics.txt +382 -0
  12. data/template/assets/naturaldocs/NaturalDocs/Help/customizinglanguages.html +52 -0
  13. data/template/assets/naturaldocs/NaturalDocs/Help/customizingtopics.html +74 -0
  14. data/template/assets/naturaldocs/NaturalDocs/Help/documenting.html +58 -0
  15. data/template/assets/naturaldocs/NaturalDocs/Help/documenting/reference.html +146 -0
  16. data/template/assets/naturaldocs/NaturalDocs/Help/documenting/walkthrough.html +180 -0
  17. data/template/assets/naturaldocs/NaturalDocs/Help/example/Default.css +528 -0
  18. data/template/assets/naturaldocs/NaturalDocs/Help/example/NaturalDocs.js +204 -0
  19. data/template/assets/naturaldocs/NaturalDocs/Help/examples.css +90 -0
  20. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/background.png +0 -0
  21. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/leftside.png +0 -0
  22. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/logo.png +0 -0
  23. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbody.png +0 -0
  24. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbodybg.png +0 -0
  25. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overleftmargin.png +0 -0
  26. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenu.png +0 -0
  27. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenubg.png +0 -0
  28. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/rightside.png +0 -0
  29. data/template/assets/naturaldocs/NaturalDocs/Help/images/logo.gif +0 -0
  30. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/about.png +0 -0
  31. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/background.png +0 -0
  32. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomleft.png +0 -0
  33. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomright.png +0 -0
  34. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/community.png +0 -0
  35. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/customizing.png +0 -0
  36. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/using.png +0 -0
  37. data/template/assets/naturaldocs/NaturalDocs/Help/index.html +9 -0
  38. data/template/assets/naturaldocs/NaturalDocs/Help/javascript/BrowserStyles.js +77 -0
  39. data/template/assets/naturaldocs/NaturalDocs/Help/javascript/PNGHandling.js +72 -0
  40. data/template/assets/naturaldocs/NaturalDocs/Help/keywords.html +38 -0
  41. data/template/assets/naturaldocs/NaturalDocs/Help/languages.html +32 -0
  42. data/template/assets/naturaldocs/NaturalDocs/Help/menu.html +79 -0
  43. data/template/assets/naturaldocs/NaturalDocs/Help/output.html +84 -0
  44. data/template/assets/naturaldocs/NaturalDocs/Help/running.html +40 -0
  45. data/template/assets/naturaldocs/NaturalDocs/Help/styles.css +290 -0
  46. data/template/assets/naturaldocs/NaturalDocs/Help/styles.html +52 -0
  47. data/template/assets/naturaldocs/NaturalDocs/Help/troubleshooting.html +18 -0
  48. data/template/assets/naturaldocs/NaturalDocs/Info/CSSGuide.txt +947 -0
  49. data/template/assets/naturaldocs/NaturalDocs/Info/File Parsing.txt +83 -0
  50. data/template/assets/naturaldocs/NaturalDocs/Info/HTMLTestCases.pm +269 -0
  51. data/template/assets/naturaldocs/NaturalDocs/Info/Languages.txt +107 -0
  52. data/template/assets/naturaldocs/NaturalDocs/Info/NDMarkup.txt +91 -0
  53. data/template/assets/naturaldocs/NaturalDocs/Info/Symbol Management.txt +59 -0
  54. data/template/assets/naturaldocs/NaturalDocs/Info/images/Logo.png +0 -0
  55. data/template/assets/naturaldocs/NaturalDocs/JavaScript/NaturalDocs.js +836 -0
  56. data/template/assets/naturaldocs/NaturalDocs/License-GPL.txt +341 -0
  57. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/BinaryFile.pm +294 -0
  58. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder.pm +280 -0
  59. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/Base.pm +348 -0
  60. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/FramedHTML.pm +345 -0
  61. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTML.pm +398 -0
  62. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTMLBase.pm +3693 -0
  63. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy.pm +860 -0
  64. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/Class.pm +412 -0
  65. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/File.pm +157 -0
  66. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ConfigFile.pm +497 -0
  67. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Constants.pm +165 -0
  68. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/DefineMembers.pm +100 -0
  69. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Error.pm +305 -0
  70. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/File.pm +540 -0
  71. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable.pm +383 -0
  72. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/Reference.pm +44 -0
  73. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/String.pm +110 -0
  74. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages.pm +1475 -0
  75. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/ActionScript.pm +1473 -0
  76. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Ada.pm +38 -0
  77. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced.pm +828 -0
  78. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/Scope.pm +95 -0
  79. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm +70 -0
  80. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Base.pm +832 -0
  81. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/CSharp.pm +1484 -0
  82. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/PLSQL.pm +319 -0
  83. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Pascal.pm +143 -0
  84. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Perl.pm +1370 -0
  85. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype.pm +92 -0
  86. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype/Parameter.pm +87 -0
  87. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Simple.pm +503 -0
  88. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Tcl.pm +219 -0
  89. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu.pm +3406 -0
  90. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu/Entry.pm +201 -0
  91. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/NDMarkup.pm +76 -0
  92. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser.pm +1331 -0
  93. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/JavaDoc.pm +464 -0
  94. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/Native.pm +1060 -0
  95. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/ParsedTopic.pm +253 -0
  96. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project.pm +1402 -0
  97. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/ImageFile.pm +160 -0
  98. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/SourceFile.pm +113 -0
  99. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ReferenceString.pm +334 -0
  100. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings.pm +1418 -0
  101. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings/BuildTarget.pm +66 -0
  102. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB.pm +678 -0
  103. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Extension.pm +84 -0
  104. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/File.pm +129 -0
  105. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Item.pm +201 -0
  106. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/ItemDefinition.pm +45 -0
  107. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/WatchedFileDefinitions.pm +159 -0
  108. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/StatusMessage.pm +102 -0
  109. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolString.pm +212 -0
  110. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable.pm +1984 -0
  111. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/File.pm +186 -0
  112. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/IndexElement.pm +522 -0
  113. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Reference.pm +273 -0
  114. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/ReferenceTarget.pm +97 -0
  115. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Symbol.pm +428 -0
  116. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/SymbolDefinition.pm +96 -0
  117. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics.pm +1319 -0
  118. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics/Type.pm +151 -0
  119. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Version.pm +384 -0
  120. data/template/assets/naturaldocs/NaturalDocs/NaturalDocs +400 -0
  121. data/template/assets/naturaldocs/NaturalDocs/NaturalDocs.bat +17 -0
  122. data/template/assets/naturaldocs/NaturalDocs/Styles/Default.css +767 -0
  123. data/template/assets/naturaldocs/NaturalDocs/Styles/Roman.css +765 -0
  124. data/template/assets/naturaldocs/NaturalDocs/Styles/Small.css +763 -0
  125. data/template/assets/utilities/pngout +0 -0
  126. data/template/deploy/public_html/.htaccess +0 -0
  127. data/template/documentation/js/.htaccess +0 -0
  128. data/template/src/html/.htaccess +76 -0
  129. data/template/src/html/css/cmn/global.css +96 -0
  130. data/template/src/html/css/cmn/ie.css +15 -0
  131. data/template/src/html/css/cmn/ie6.css +15 -0
  132. data/template/src/html/images/cmn/.htaccess +0 -0
  133. data/template/src/html/images/tmp/.htaccess +0 -0
  134. data/template/src/html/includes/debug.inc +5 -0
  135. data/template/src/html/includes/footer.inc +52 -0
  136. data/template/src/html/includes/header.inc +61 -0
  137. data/template/src/html/includes/html.inc +3 -0
  138. data/template/src/html/includes/namespace.inc +19 -0
  139. data/template/src/html/includes/page.inc +151 -0
  140. data/template/src/html/index.html +35 -0
  141. data/template/src/html/js/cmn/bootstrap.js +74 -0
  142. data/template/src/html/js/cmn/global.js +142 -0
  143. data/template/src/html/js/cmn/lib/LAB.js +348 -0
  144. data/template/src/html/min/.htaccess +4 -0
  145. data/template/src/html/min/MinifyCLI.php +19 -0
  146. data/template/src/html/min/README.txt +132 -0
  147. data/template/src/html/min/builder/_index.js +242 -0
  148. data/template/src/html/min/builder/bm.js +36 -0
  149. data/template/src/html/min/builder/index.php +182 -0
  150. data/template/src/html/min/builder/ocCheck.php +36 -0
  151. data/template/src/html/min/builder/rewriteTest.js +1 -0
  152. data/template/src/html/min/config.php +187 -0
  153. data/template/src/html/min/groupsConfig.php +34 -0
  154. data/template/src/html/min/index.php +66 -0
  155. data/template/src/html/min/lib/FirePHP.php +1370 -0
  156. data/template/src/html/min/lib/HTTP/ConditionalGet.php +348 -0
  157. data/template/src/html/min/lib/HTTP/Encoder.php +326 -0
  158. data/template/src/html/min/lib/JSMin.php +314 -0
  159. data/template/src/html/min/lib/JSMinPlus.php +1872 -0
  160. data/template/src/html/min/lib/Minify.php +532 -0
  161. data/template/src/html/min/lib/Minify/Build.php +103 -0
  162. data/template/src/html/min/lib/Minify/CSS.php +83 -0
  163. data/template/src/html/min/lib/Minify/CSS/Compressor.php +250 -0
  164. data/template/src/html/min/lib/Minify/CSS/UriRewriter.php +270 -0
  165. data/template/src/html/min/lib/Minify/Cache/APC.php +130 -0
  166. data/template/src/html/min/lib/Minify/Cache/File.php +125 -0
  167. data/template/src/html/min/lib/Minify/Cache/Memcache.php +137 -0
  168. data/template/src/html/min/lib/Minify/ClosureCompiler.php +85 -0
  169. data/template/src/html/min/lib/Minify/CommentPreserver.php +90 -0
  170. data/template/src/html/min/lib/Minify/Controller/Base.php +202 -0
  171. data/template/src/html/min/lib/Minify/Controller/Files.php +78 -0
  172. data/template/src/html/min/lib/Minify/Controller/Groups.php +94 -0
  173. data/template/src/html/min/lib/Minify/Controller/MinApp.php +132 -0
  174. data/template/src/html/min/lib/Minify/Controller/Page.php +82 -0
  175. data/template/src/html/min/lib/Minify/Controller/Version1.php +118 -0
  176. data/template/src/html/min/lib/Minify/HTML.php +245 -0
  177. data/template/src/html/min/lib/Minify/ImportProcessor.php +157 -0
  178. data/template/src/html/min/lib/Minify/Lines.php +131 -0
  179. data/template/src/html/min/lib/Minify/Logger.php +45 -0
  180. data/template/src/html/min/lib/Minify/Packer.php +37 -0
  181. data/template/src/html/min/lib/Minify/Source.php +187 -0
  182. data/template/src/html/min/lib/Minify/YUICompressor.php +139 -0
  183. data/template/src/html/min/lib/Solar/Dir.php +199 -0
  184. data/template/src/html/min/lib/closure-compiler.jar +0 -0
  185. data/template/src/html/min/lib/yuicompressor-2.4.2.jar +0 -0
  186. data/template/src/html/min/utils.php +90 -0
  187. data/template/src/templates/css/template.css +7 -0
  188. data/template/src/templates/js/template.js +72 -0
  189. data/template/src/templates/template.html +18 -0
  190. data/template/src/yaml/config.yml +46 -0
  191. data/template/src/yaml/deploy.yml +35 -0
  192. data/test/bixbite_test.rb +7 -0
  193. data/test/test_helper.rb +10 -0
  194. metadata +278 -0
@@ -0,0 +1,4 @@
1
+ <IfModule mod_rewrite.c>
2
+ RewriteEngine on
3
+ RewriteRule ^([a-z]=.*) index.php?$1 [L,NE]
4
+ </IfModule>
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/php
2
+
3
+ <?php
4
+
5
+ define('MINIFY_MIN_DIR', dirname(__FILE__));
6
+
7
+ // load config
8
+ require MINIFY_MIN_DIR . '/config.php';
9
+
10
+ // setup include path
11
+ set_include_path($min_libPath . PATH_SEPARATOR . get_include_path());
12
+
13
+ require_once 'Minify.php';
14
+
15
+ array_shift($argv);
16
+ $out = Minify::combine($argv);
17
+ // file_put_contents($outputPath, $out);
18
+ echo $out;
19
+ ?>
@@ -0,0 +1,132 @@
1
+ The files in this directory represent the default Minify setup designed to ease
2
+ integration with your site. This app will combine and minify your Javascript or
3
+ CSS files and serve them with HTTP compression and cache headers.
4
+
5
+
6
+ RECOMMENDED
7
+
8
+ It's recommended to edit config.php to set $min_cachePath to a writeable
9
+ (by PHP) directory on your system. This will improve performance.
10
+
11
+
12
+ GETTING STARTED
13
+
14
+ The quickest way to get started is to use the Minify URI Builder application
15
+ on your website: http://example.com/min/builder/
16
+
17
+
18
+ MINIFYING A SINGLE FILE
19
+
20
+ Let's say you want to serve this file:
21
+ http://example.com/wp-content/themes/default/default.css
22
+
23
+ Here's the "Minify URL" for this file:
24
+ http://example.com/min/?f=wp-content/themes/default/default.css
25
+
26
+ In other words, the "f" argument is set to the file path from root without the
27
+ initial "/". As CSS files may contain relative URIs, Minify will automatically
28
+ "fix" these by rewriting them as root relative.
29
+
30
+
31
+ COMBINING MULTIPLE FILES IN ONE DOWNLOAD
32
+
33
+ Separate the paths given to "f" with commas.
34
+
35
+ Let's say you have CSS files at these URLs:
36
+ http://example.com/scripts/jquery-1.2.6.js
37
+ http://example.com/scripts/site.js
38
+
39
+ You can combine these files through Minify by requesting this URL:
40
+ http://example.com/min/?f=scripts/jquery-1.2.6.js,scripts/site.js
41
+
42
+
43
+ SIMPLIFYING URLS WITH A BASE PATH
44
+
45
+ If you're combining files that share the same ancestor directory, you can use
46
+ the "b" argument to set the base directory for the "f" argument. Do not include
47
+ the leading or trailing "/" characters.
48
+
49
+ E.g., the following URLs will serve the exact same content:
50
+ http://example.com/min/?f=scripts/jquery-1.2.6.js,scripts/site.js,scripts/home.js
51
+ http://example.com/min/?b=scripts&f=jquery-1.2.6.js,site.js,home.js
52
+
53
+
54
+ MINIFY URLS IN HTML
55
+
56
+ In (X)HTML files, don't forget to replace any "&" characters with "&amp;".
57
+
58
+
59
+ SPECIFYING ALLOWED DIRECTORIES
60
+
61
+ By default, Minify will serve any *.css/*.js files within the DOCUMENT_ROOT. If
62
+ you'd prefer to limit Minify's access to certain directories, set the
63
+ $min_serveOptions['minApp']['allowDirs'] array in config.php. E.g. to limit
64
+ to the /js and /themes/default directories, use:
65
+
66
+ $min_serveOptions['minApp']['allowDirs'] = array('//js', '//themes/default');
67
+
68
+
69
+ GROUPS: FASTER PERFORMANCE AND BETTER URLS
70
+
71
+ For the best performance, edit groupsConfig.php to pre-specify groups of files
72
+ to be combined under preset keys. E.g., here's an example configuration in
73
+ groupsConfig.php:
74
+
75
+ return array(
76
+ 'js' => array('//js/Class.js', '//js/email.js')
77
+ );
78
+
79
+ This pre-selects the following files to be combined under the key "js":
80
+ http://example.com/js/Class.js
81
+ http://example.com/js/email.js
82
+
83
+ You can now serve these files with this simple URL:
84
+ http://example.com/min/?g=js
85
+
86
+
87
+ GROUPS: SPECIFYING FILES OUTSIDE THE DOC_ROOT
88
+
89
+ In the groupsConfig.php array, the "//" in the file paths is a shortcut for
90
+ the DOCUMENT_ROOT, but you can also specify paths from the root of the filesystem
91
+ or relative to the DOC_ROOT:
92
+
93
+ return array(
94
+ 'js' => array(
95
+ '//js/file.js' // file within DOC_ROOT
96
+ ,'//../file.js' // file in parent directory of DOC_ROOT
97
+ ,'C:/Users/Steve/file.js' // file anywhere on filesystem
98
+ )
99
+ );
100
+
101
+
102
+ FAR-FUTURE EXPIRES HEADERS
103
+
104
+ Minify can send far-future (one year) Expires headers. To enable this you must
105
+ add a number to the querystring (e.g. /min/?g=js&1234 or /min/f=file.js&1234)
106
+ and alter it whenever a source file is changed. If you have a build process you
107
+ can use a build/source control revision number.
108
+
109
+ If you serve files as a group, you can use the utility function Minify_groupUri()
110
+ to get a "versioned" Minify URI for use in your HTML. E.g.:
111
+
112
+ <?php
113
+ // add /min/lib to your include_path first!
114
+ require $_SERVER['DOCUMENT_ROOT'] . '/min/utils.php';
115
+
116
+ $jsUri = Minify_groupUri('js');
117
+ echo "<script type='text/javascript' src='{$jsUri}'></script>";
118
+
119
+
120
+ DEBUG MODE
121
+
122
+ In debug mode, instead of compressing files, Minify sends combined files with
123
+ comments prepended to each line to show the line number in the original source
124
+ file. To enable this, set $min_allowDebugFlag to true in config.php and append
125
+ "&debug=1" to your URIs. E.g. /min/?f=script1.js,script2.js&debug=1
126
+
127
+ Known issue: files with comment-like strings/regexps can cause problems in this mode.
128
+
129
+
130
+ QUESTIONS?
131
+
132
+ http://groups.google.com/group/minify
@@ -0,0 +1,242 @@
1
+ var MUB = {
2
+ _uid : 0
3
+ ,_minRoot : '/min/?'
4
+ ,checkRewrite : function () {
5
+ var testUri = location.pathname.replace(/\/[^\/]*$/, '/rewriteTest.js').substr(1);
6
+ function fail() {
7
+ $('#minRewriteFailed')[0].className = 'topNote';
8
+ };
9
+ $.ajax({
10
+ url : '../f=' + testUri + '&' + (new Date()).getTime()
11
+ ,success : function (data) {
12
+ if (data === '1') {
13
+ MUB._minRoot = '/min/';
14
+ $('span.minRoot').html('/min/');
15
+ } else
16
+ fail();
17
+ }
18
+ ,error : fail
19
+ });
20
+ }
21
+ /**
22
+ * Get markup for new source LI element
23
+ */
24
+ ,newLi : function () {
25
+ return '<li id="li' + MUB._uid + '">http://' + location.host + '/<input type=text size=20>'
26
+ + ' <button title="Remove">x</button> <button title="Include Earlier">&uarr;</button>'
27
+ + ' <button title="Include Later">&darr;</button> <span></span></li>';
28
+ }
29
+ /**
30
+ * Add new empty source LI and attach handlers to buttons
31
+ */
32
+ ,addLi : function () {
33
+ $('#sources').append(MUB.newLi());
34
+ var li = $('#li' + MUB._uid)[0];
35
+ $('button[title=Remove]', li).click(function () {
36
+ $('#results').hide();
37
+ var hadValue = !!$('input', li)[0].value;
38
+ $(li).remove();
39
+ });
40
+ $('button[title$=Earlier]', li).click(function () {
41
+ $(li).prev('li').find('input').each(function () {
42
+ $('#results').hide();
43
+ // this = previous li input
44
+ var tmp = this.value;
45
+ this.value = $('input', li).val();
46
+ $('input', li).val(tmp);
47
+ MUB.updateAllTestLinks();
48
+ });
49
+ });
50
+ $('button[title$=Later]', li).click(function () {
51
+ $(li).next('li').find('input').each(function () {
52
+ $('#results').hide();
53
+ // this = next li input
54
+ var tmp = this.value;
55
+ this.value = $('input', li).val();
56
+ $('input', li).val(tmp);
57
+ MUB.updateAllTestLinks();
58
+ });
59
+ });
60
+ ++MUB._uid;
61
+ }
62
+ /**
63
+ * In the context of a source LI element, this will analyze the URI in
64
+ * the INPUT and check the URL on the site.
65
+ */
66
+ ,liUpdateTestLink : function () { // call in context of li element
67
+ if (! $('input', this)[0].value)
68
+ return;
69
+ var li = this;
70
+ $('span', this).html('');
71
+ var url = 'http://' + location.host + '/'
72
+ + $('input', this)[0].value.replace(/^\//, '');
73
+ $.ajax({
74
+ url : url
75
+ ,complete : function (xhr, stat) {
76
+ if ('success' == stat)
77
+ $('span', li).html('&#x2713;');
78
+ else {
79
+ $('span', li).html('<button><b>404! </b> recheck</button>')
80
+ .find('button').click(function () {
81
+ MUB.liUpdateTestLink.call(li);
82
+ });
83
+ }
84
+ }
85
+ ,dataType : 'text'
86
+ });
87
+ }
88
+ /**
89
+ * Check all source URLs
90
+ */
91
+ ,updateAllTestLinks : function () {
92
+ $('#sources li').each(MUB.liUpdateTestLink);
93
+ }
94
+ /**
95
+ * In a given array of strings, find the character they all have at
96
+ * a particular index
97
+ * @param Array arr array of strings
98
+ * @param Number pos index to check
99
+ * @return mixed a common char or '' if any do not match
100
+ */
101
+ ,getCommonCharAtPos : function (arr, pos) {
102
+ var i
103
+ ,l = arr.length
104
+ ,c = arr[0].charAt(pos);
105
+ if (c === '' || l === 1)
106
+ return c;
107
+ for (i = 1; i < l; ++i)
108
+ if (arr[i].charAt(pos) !== c)
109
+ return '';
110
+ return c;
111
+ }
112
+ /**
113
+ * Get the shortest URI to minify the set of source files
114
+ * @param Array sources URIs
115
+ */
116
+ ,getBestUri : function (sources) {
117
+ var pos = 0
118
+ ,base = ''
119
+ ,c;
120
+ while (true) {
121
+ c = MUB.getCommonCharAtPos(sources, pos);
122
+ if (c === '')
123
+ break;
124
+ else
125
+ base += c;
126
+ ++pos;
127
+ }
128
+ base = base.replace(/[^\/]+$/, '');
129
+ var uri = MUB._minRoot + 'f=' + sources.join(',');
130
+ if (base.charAt(base.length - 1) === '/') {
131
+ // we have a base dir!
132
+ var basedSources = sources
133
+ ,i
134
+ ,l = sources.length;
135
+ for (i = 0; i < l; ++i) {
136
+ basedSources[i] = sources[i].substr(base.length);
137
+ }
138
+ base = base.substr(0, base.length - 1);
139
+ var bUri = MUB._minRoot + 'b=' + base + '&f=' + basedSources.join(',');
140
+ //window.console && console.log([uri, bUri]);
141
+ uri = uri.length < bUri.length
142
+ ? uri
143
+ : bUri;
144
+ }
145
+ return uri;
146
+ }
147
+ /**
148
+ * Create the Minify URI for the sources
149
+ */
150
+ ,update : function () {
151
+ MUB.updateAllTestLinks();
152
+ var sources = []
153
+ ,ext = false
154
+ ,fail = false;
155
+ $('#sources input').each(function () {
156
+ var m, val;
157
+ if (! fail && this.value && (m = this.value.match(/\.(css|js)$/))) {
158
+ var thisExt = m[1];
159
+ if (ext === false)
160
+ ext = thisExt;
161
+ else if (thisExt !== ext) {
162
+ fail = true;
163
+ return alert('extensions must match!');
164
+ }
165
+ this.value = this.value.replace(/^\//, '');
166
+ if (-1 != $.inArray(this.value, sources)) {
167
+ fail = true;
168
+ return alert('duplicate file!');
169
+ }
170
+ sources.push(this.value);
171
+ }
172
+ });
173
+ if (fail || ! sources.length)
174
+ return;
175
+ $('#groupConfig').val(" 'keyName' => array('//" + sources.join("', '//") + "'),");
176
+ var uri = MUB.getBestUri(sources)
177
+ ,uriH = uri.replace(/</, '&lt;').replace(/>/, '&gt;').replace(/&/, '&amp;');
178
+ $('#uriA').html(uriH)[0].href = uri;
179
+ $('#uriHtml').val(
180
+ ext === 'js'
181
+ ? '<script type="text/javascript" src="' + uriH + '"></script>'
182
+ : '<link type="text/css" rel="stylesheet" href="' + uriH + '" />'
183
+ );
184
+ $('#results').show();
185
+ }
186
+ /**
187
+ * Handler for the "Add file +" button
188
+ */
189
+ ,addButtonClick : function () {
190
+ $('#results').hide();
191
+ MUB.addLi();
192
+ MUB.updateAllTestLinks();
193
+ $('#update').show().click(MUB.update);
194
+ $('#sources li:last input')[0].focus();
195
+ }
196
+ /**
197
+ * Runs on DOMready
198
+ */
199
+ ,init : function () {
200
+ $('#app').show();
201
+ $('#sources').html('');
202
+ $('#add button').click(MUB.addButtonClick);
203
+ // make easier to copy text out of
204
+ $('#uriHtml, #groupConfig').click(function () {
205
+ this.select();
206
+ }).focus(function () {
207
+ this.select();
208
+ });
209
+ $('a.ext').attr({target:'_blank'});
210
+ if (location.hash) {
211
+ // make links out of URIs from bookmarklet
212
+ $('#getBm').hide();
213
+ $('#bmUris').html('<p><strong>Found by bookmarklet:</strong> /<a href=#>'
214
+ + location.hash.substr(1).split(',').join('</a> | /<a href=#>')
215
+ + '</a></p>'
216
+ );
217
+ $('#bmUris a').click(function () {
218
+ MUB.addButtonClick();
219
+ $('#sources li:last input').val(this.innerHTML)
220
+ MUB.liUpdateTestLink.call($('#sources li:last')[0]);
221
+ $('#results').hide();
222
+ return false;
223
+ }).attr({title:'Add file +'});
224
+ } else {
225
+ // copy bookmarklet code into href
226
+ var bmUri = location.pathname.replace(/\/[^\/]*$/, '/bm.js').substr(1);
227
+ $.ajax({
228
+ url : '../?f=' + bmUri
229
+ ,success : function (code) {
230
+ $('#bm')[0].href = code
231
+ .replace('%BUILDER_URL%', location.href)
232
+ .replace(/\n/g, ' ');
233
+ }
234
+ ,dataType : 'text'
235
+ });
236
+ $.browser.msie && $('#getBm p:last').append(' Sorry, not supported in MSIE!');
237
+ MUB.addButtonClick();
238
+ }
239
+ MUB.checkRewrite();
240
+ }
241
+ };
242
+ window.onload = MUB.init;
@@ -0,0 +1,36 @@
1
+ javascript:(function() {
2
+ var d = document
3
+ ,uris = []
4
+ ,i = 0
5
+ ,o
6
+ ,home = (location + '').split('/').splice(0, 3).join('/') + '/';
7
+ function add(uri) {
8
+ return (0 === uri.indexOf(home))
9
+ && (!/[\?&]/.test(uri))
10
+ && uris.push(escape(uri.substr(home.length)));
11
+ };
12
+ function sheet(ss) {
13
+ // we must check the domain with add() before accessing ss.cssRules
14
+ // otherwise a security exception will be thrown
15
+ if (ss.href && add(ss.href) && ss.cssRules) {
16
+ var i = 0, r;
17
+ while (r = ss.cssRules[i++])
18
+ r.styleSheet && sheet(r.styleSheet);
19
+ }
20
+ };
21
+ while (o = d.getElementsByTagName('script')[i++])
22
+ o.src && !(o.type && /vbs/i.test(o.type)) && add(o.src);
23
+ i = 0;
24
+ while (o = d.styleSheets[i++])
25
+ /* http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html#StyleSheets-DocumentStyle-styleSheets
26
+ document.styleSheet is a list property where [0] accesses the 1st element and
27
+ [outOfRange] returns null. In IE, styleSheets is a function, and also throws an
28
+ exception when you check the out of bounds index. (sigh) */
29
+ sheet(o);
30
+ if (uris.length)
31
+ window.open('%BUILDER_URL%#' + uris.join(','));
32
+ else
33
+ alert('No js/css files found with URLs within "'
34
+ + home.split('/')[2]
35
+ + '".\n(This tool is limited to URLs with the same domain.)');
36
+ })();
@@ -0,0 +1,182 @@
1
+ <?php
2
+
3
+ if (phpversion() < 5) {
4
+ exit('Minify requires PHP5 or greater.');
5
+ }
6
+
7
+ // check for auto-encoding
8
+ $encodeOutput = (function_exists('gzdeflate')
9
+ && !ini_get('zlib.output_compression'));
10
+
11
+ require dirname(__FILE__) . '/../config.php';
12
+
13
+ if (! $min_enableBuilder) {
14
+ header('Location: /');
15
+ exit();
16
+ }
17
+
18
+ ob_start();
19
+ ?>
20
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
21
+ <head>
22
+ <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
23
+ <title>Minify URI Builder</title>
24
+ <style type="text/css">
25
+ body {margin:1em 60px;}
26
+ h1, h2, h3 {margin-left:-25px; position:relative;}
27
+ h1 {margin-top:0;}
28
+ #sources {margin:0; padding:0;}
29
+ #sources li {margin:0 0 0 40px}
30
+ #sources li input {margin-left:2px}
31
+ #add {margin:5px 0 1em 40px}
32
+ .hide {display:none}
33
+ #uriTable {border-collapse:collapse;}
34
+ #uriTable td, #uriTable th {padding-top:10px;}
35
+ #uriTable th {padding-right:10px;}
36
+ #groupConfig {font-family:monospace;}
37
+ b {color:#c00}
38
+ .topNote {background: #ff9; display:inline-block; padding:.5em .6em; margin:0 0 1em;}
39
+ .topWarning {background:#c00; color:#fff; padding:.5em .6em; margin:0 0 1em;}
40
+ </style>
41
+ </head>
42
+
43
+ <?php if (! isset($min_cachePath)): ?>
44
+ <p class=topNote><strong>Note:</strong> Please set <code>$min_cachePath</code>
45
+ in /min/config.php to improve performance.</p>
46
+ <?php endIf; ?>
47
+
48
+ <p id=minRewriteFailed class="hide"><strong>Note:</strong> Your webserver does not seem to
49
+ support mod_rewrite (used in /min/.htaccess). Your Minify URIs will contain "?", which
50
+ <a href="http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/"
51
+ >may reduce the benefit of proxy cache servers</a>.</p>
52
+
53
+ <h1>Minify URI Builder</h1>
54
+
55
+ <noscript><p class="topNote">Javascript and a browser supported by jQuery 1.2.6 is required
56
+ for this application.</p></noscript>
57
+
58
+ <div id=app class=hide>
59
+
60
+ <p>Create a list of Javascript or CSS files (or 1 is fine) you'd like to combine
61
+ and click [Update].</p>
62
+
63
+ <ol id=sources><li></li></ol>
64
+ <div id=add><button>Add file +</button></div>
65
+
66
+ <div id=bmUris></div>
67
+
68
+ <p><button id=update class=hide>Update</button></p>
69
+
70
+ <div id=results class=hide>
71
+
72
+ <h2>Minify URI</h2>
73
+ <p>Place this URI in your HTML to serve the files above combined, minified, compressed and
74
+ with cache headers.</p>
75
+ <table id=uriTable>
76
+ <tr><th>URI</th><td><a id=uriA class=ext>/min</a> <small>(opens in new window)</small></td></tr>
77
+ <tr><th>HTML</th><td><input id=uriHtml type=text size=100 readonly></td></tr>
78
+ </table>
79
+
80
+ <h2>How to serve these files as a group</h2>
81
+ <p>For the best performance you can serve these files as a pre-defined group with a URI
82
+ like: <code><span class=minRoot>/min/?</span>g=keyName</code></p>
83
+ <p>To do this, add a line like this to /min/groupsConfig.php:</p>
84
+
85
+ <pre><code>return array(
86
+ <span style="color:#666">... your existing groups here ...</span>
87
+ <input id=groupConfig size=100 type=text readonly>
88
+ );</code></pre>
89
+
90
+ <p><em>Make sure to replace <code>keyName</code> with a unique key for this group.</em></p>
91
+ </div>
92
+
93
+ <div id=getBm>
94
+ <h3>Find URIs on a Page</h3>
95
+ <p>You can use the bookmarklet below to fetch all CSS &amp; Javascript URIs from a page
96
+ on your site. When you active it, this page will open in a new window with a list of
97
+ available URIs to add.</p>
98
+
99
+ <p><a id=bm>Create Minify URIs</a> <small>(right-click, add to bookmarks)</small></p>
100
+ </div>
101
+
102
+ <h3>Combining CSS files that contain <code>@import</code></h3>
103
+ <p>If your CSS files contain <code>@import</code> declarations, Minify will not
104
+ remove them. Therefore, you will want to remove those that point to files already
105
+ in your list, and move any others to the top of the first file in your list
106
+ (imports below any styles will be ignored by browsers as invalid).</p>
107
+ <p>If you desire, you can use Minify URIs in imports and they will not be touched
108
+ by Minify. E.g. <code>@import "<span class=minRoot>/min/?</span>g=css2";</code></p>
109
+
110
+ </div><!-- #app -->
111
+
112
+ <hr>
113
+ <p>Need help? Search or post to the <a class=ext
114
+ href="http://groups.google.com/group/minify">Minify discussion list</a>.</p>
115
+ <p><small>This app is minified :) <a class=ext
116
+ href="http://code.google.com/p/minify/source/browse/trunk/min/builder/index.php">view
117
+ source</a></small></p>
118
+
119
+ <script type="text/javascript"
120
+ src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
121
+
122
+ <script type="text/javascript">
123
+ $(function () {
124
+ // detection of double output encoding
125
+ var msg = '<\p class=topWarning><\strong>Warning:<\/strong> ';
126
+ var url = 'ocCheck.php?' + (new Date()).getTime();
127
+ $.get(url, function (ocStatus) {
128
+ $.get(url + '&hello=1', function (ocHello) {
129
+ if (ocHello != 'World!') {
130
+ msg += 'It appears output is being automatically compressed, interfering '
131
+ + ' with Minify\'s own compression. ';
132
+ if (ocStatus == '1')
133
+ msg += 'The option "zlib.output_compression" is enabled in your PHP configuration. '
134
+ + 'Minify set this to "0", but it had no effect. This option must be disabled '
135
+ + 'in php.ini or .htaccess.';
136
+ else
137
+ msg += 'The option "zlib.output_compression" is disabled in your PHP configuration '
138
+ + 'so this behavior is likely due to a server option.';
139
+ $(document.body).prepend(msg + '<\/p>');
140
+ } else
141
+ if (ocStatus == '1')
142
+ $(document.body).prepend('<\p class=topNote><\strong>Note:</\strong> The option '
143
+ + '"zlib.output_compression" is enabled in your PHP configuration, but has been '
144
+ + 'successfully disabled via ini_set(). If you experience mangled output you '
145
+ + 'may want to consider disabling this option in your PHP configuration.<\/p>'
146
+ );
147
+ });
148
+ });
149
+ });
150
+ </script>
151
+ <script type="text/javascript">
152
+ // workaround required to test when /min isn't child of web root
153
+ var src = location.pathname.replace(/\/[^\/]*$/, '/_index.js').substr(1);
154
+ document.write('<\script type="text/javascript" src="../?f=' + src + '"><\/script>');
155
+ </script>
156
+
157
+ <?php
158
+
159
+ $serveOpts = array(
160
+ 'content' => ob_get_contents()
161
+ ,'id' => __FILE__
162
+ ,'lastModifiedTime' => max(
163
+ // regenerate cache if either of these change
164
+ filemtime(__FILE__)
165
+ ,filemtime(dirname(__FILE__) . '/../config.php')
166
+ )
167
+ ,'minifyAll' => true
168
+ ,'encodeOutput' => $encodeOutput
169
+ );
170
+ ob_end_clean();
171
+
172
+ set_include_path(dirname(__FILE__) . '/../lib' . PATH_SEPARATOR . get_include_path());
173
+
174
+ require 'Minify.php';
175
+
176
+ if (0 === stripos(PHP_OS, 'win')) {
177
+ Minify::setDocRoot(); // we may be on IIS
178
+ }
179
+ Minify::setCache(isset($min_cachePath) ? $min_cachePath : null);
180
+ Minify::$uploaderHoursBehind = $min_uploaderHoursBehind;
181
+
182
+ Minify::serve('Page', $serveOpts);