html5-starter 0.1.3b

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/LICENSE +3 -0
  2. data/README.md +135 -0
  3. data/VERSION +1 -0
  4. data/lib/app/helpers/html5_boilerplate_helper.rb +47 -0
  5. data/lib/html5-boilerplate.rb +6 -0
  6. data/stylesheets/_html5-boilerplate.scss +15 -0
  7. data/stylesheets/html5-boilerplate/_fonts.scss +36 -0
  8. data/stylesheets/html5-boilerplate/_handheld.scss +8 -0
  9. data/stylesheets/html5-boilerplate/_helpers.scss +25 -0
  10. data/stylesheets/html5-boilerplate/_print.scss +20 -0
  11. data/stylesheets/html5-boilerplate/_reset.scss +50 -0
  12. data/stylesheets/html5-boilerplate/_styles.scss +100 -0
  13. data/templates/project/_flashes.html.haml +4 -0
  14. data/templates/project/_footer.html.haml +2 -0
  15. data/templates/project/_head.html.haml +32 -0
  16. data/templates/project/_header.html.haml +1 -0
  17. data/templates/project/_javascripts.html.haml +38 -0
  18. data/templates/project/_stylesheets.html.haml +8 -0
  19. data/templates/project/application.html.haml +15 -0
  20. data/templates/project/files/404.html +22 -0
  21. data/templates/project/files/apple-touch-icon.png +0 -0
  22. data/templates/project/files/build/build.xml +636 -0
  23. data/templates/project/files/build/buildinfo.properties +5 -0
  24. data/templates/project/files/build/config/build.properties +3 -0
  25. data/templates/project/files/build/config/default.properties +79 -0
  26. data/templates/project/files/build/config/project.properties +49 -0
  27. data/templates/project/files/build/createproject.sh +73 -0
  28. data/templates/project/files/build/tools/ant-contrib-1.0b3.jar +0 -0
  29. data/templates/project/files/build/tools/css-compressor/CSSCompression.php +465 -0
  30. data/templates/project/files/build/tools/css-compressor/changelog.txt +22 -0
  31. data/templates/project/files/build/tools/css-compressor/cli.php +101 -0
  32. data/templates/project/files/build/tools/css-compressor/helpers/hex2short-colors.json +39 -0
  33. data/templates/project/files/build/tools/css-compressor/helpers/hex2short-safe.json +16 -0
  34. data/templates/project/files/build/tools/css-compressor/helpers/long2hex-colors.json +127 -0
  35. data/templates/project/files/build/tools/css-compressor/lib/Cleanup.php +218 -0
  36. data/templates/project/files/build/tools/css-compressor/lib/Color.php +199 -0
  37. data/templates/project/files/build/tools/css-compressor/lib/Combine.php +191 -0
  38. data/templates/project/files/build/tools/css-compressor/lib/Combine/Aural.php +109 -0
  39. data/templates/project/files/build/tools/css-compressor/lib/Combine/Background.php +107 -0
  40. data/templates/project/files/build/tools/css-compressor/lib/Combine/Border.php +98 -0
  41. data/templates/project/files/build/tools/css-compressor/lib/Combine/BorderOutline.php +109 -0
  42. data/templates/project/files/build/tools/css-compressor/lib/Combine/BorderRadius.php +262 -0
  43. data/templates/project/files/build/tools/css-compressor/lib/Combine/Font.php +125 -0
  44. data/templates/project/files/build/tools/css-compressor/lib/Combine/List.php +104 -0
  45. data/templates/project/files/build/tools/css-compressor/lib/Combine/MarginPadding.php +190 -0
  46. data/templates/project/files/build/tools/css-compressor/lib/Compress.php +212 -0
  47. data/templates/project/files/build/tools/css-compressor/lib/Control.php +236 -0
  48. data/templates/project/files/build/tools/css-compressor/lib/Exception.php +32 -0
  49. data/templates/project/files/build/tools/css-compressor/lib/Format.php +187 -0
  50. data/templates/project/files/build/tools/css-compressor/lib/Individuals.php +307 -0
  51. data/templates/project/files/build/tools/css-compressor/lib/Numeric.php +103 -0
  52. data/templates/project/files/build/tools/css-compressor/lib/Option.php +133 -0
  53. data/templates/project/files/build/tools/css-compressor/lib/Organize.php +149 -0
  54. data/templates/project/files/build/tools/css-compressor/lib/Selectors.php +245 -0
  55. data/templates/project/files/build/tools/css-compressor/lib/Setup.php +292 -0
  56. data/templates/project/files/build/tools/css-compressor/lib/Trim.php +213 -0
  57. data/templates/project/files/build/tools/css-compressor/license.txt +21 -0
  58. data/templates/project/files/build/tools/htmlcompressor-0.9.8.jar +0 -0
  59. data/templates/project/files/build/tools/jpegtran.exe +0 -0
  60. data/templates/project/files/build/tools/optipng-0.6.4-exe/LICENSE.txt +21 -0
  61. data/templates/project/files/build/tools/optipng-0.6.4-exe/optipng.exe +0 -0
  62. data/templates/project/files/build/tools/yuicompressor-2.4.2.jar +0 -0
  63. data/templates/project/files/crossdomain.xml +25 -0
  64. data/templates/project/files/favicon.ico +0 -0
  65. data/templates/project/files/gitignore.txt +32 -0
  66. data/templates/project/files/gitignore_placeholder.txt +2 -0
  67. data/templates/project/files/google.yml +22 -0
  68. data/templates/project/files/htaccess +415 -0
  69. data/templates/project/files/humans.txt +43 -0
  70. data/templates/project/files/lighttpd.conf +149 -0
  71. data/templates/project/files/mime.types +80 -0
  72. data/templates/project/files/nginx.conf +108 -0
  73. data/templates/project/files/robots.txt +5 -0
  74. data/templates/project/files/web.config +207 -0
  75. data/templates/project/handheld.scss +8 -0
  76. data/templates/project/index.html +81 -0
  77. data/templates/project/javascripts/libs/dd_belatedpng.js +13 -0
  78. data/templates/project/javascripts/libs/jquery-1.4.4.js +7179 -0
  79. data/templates/project/javascripts/libs/jquery-1.4.4.min.js +167 -0
  80. data/templates/project/javascripts/libs/modernizr-1.6.min.js +30 -0
  81. data/templates/project/javascripts/plugins.js +13 -0
  82. data/templates/project/javascripts/rails.js +156 -0
  83. data/templates/project/javascripts/script.js +26 -0
  84. data/templates/project/manifest.rb +101 -0
  85. data/templates/project/partials/_base.scss +23 -0
  86. data/templates/project/style.scss +70 -0
  87. metadata +171 -0
@@ -0,0 +1,236 @@
1
+ <?php
2
+ /**
3
+ * CSS Compressor [VERSION]
4
+ * [DATE]
5
+ * Corey Hart @ http://www.codenothing.com
6
+ */
7
+
8
+ Class CSSCompression_Control
9
+ {
10
+ /**
11
+ * Control Patterns
12
+ *
13
+ * @param (string) css: Holds compressed css string
14
+ * @param (string) mode: Current compression mode state
15
+ * @param (array) stats: Holds compression stats
16
+ * @param (array) getters: Array of accessible getters
17
+ */
18
+ public $css = '';
19
+ public $mode = '';
20
+ public $stats = array();
21
+ private $getters = array(
22
+ 'css',
23
+ 'mode',
24
+ 'stats',
25
+ );
26
+
27
+ /**
28
+ * Subclasses that do the ground work for this compressor
29
+ *
30
+ * @class CSSCompression: Public facing compression class
31
+ * @class Option: Option handling
32
+ * @class Trim: Does the initial trimming for the css
33
+ * @class Format: Formats the output
34
+ * @class Numeric: Handles numeric compression
35
+ * @class Color: Handles color compression
36
+ * @class Individuals: Runs compression algorithms on individual properties and values
37
+ * @class Selectors: Runs selector specific compressions
38
+ * @class Combine: Handles combining of various properties
39
+ * @class Organize: Reorganizes the sheet for futher compression
40
+ * @class Cleanup: Cleans out all injected characters during compression
41
+ * @class Compress: Central compression unit.
42
+ * @param (array) subclasses: Array holding all the subclasses for inlusion
43
+ */
44
+ public $CSSCompression;
45
+ public $Option;
46
+ public $Trim;
47
+ public $Format;
48
+ public $Numeric;
49
+ public $Color;
50
+ public $Individuals;
51
+ public $Selectors;
52
+ public $Combine;
53
+ public $Organize;
54
+ public $Cleanup;
55
+ public $Setup;
56
+ public $Compress;
57
+ private $subclasses = array(
58
+ 'Option',
59
+ 'Trim',
60
+ 'Format',
61
+ 'Numeric',
62
+ 'Color',
63
+ 'Individuals',
64
+ 'Selectors',
65
+ 'Combine',
66
+ 'Organize',
67
+ 'Cleanup',
68
+ 'Setup',
69
+ 'Compress',
70
+ );
71
+
72
+ /**
73
+ * Pull in the Compression instance and build the subclasses
74
+ *
75
+ * @param (class) CSSCompression: CSSCompression Instance
76
+ */
77
+ public function __construct( CSSCompression $CSSCompression ) {
78
+ $this->CSSCompression = $CSSCompression;
79
+
80
+ // Load all subclasses on demand
81
+ if ( ! class_exists( "CSSCompression_Option", false ) ) {
82
+ $path = dirname(__FILE__) . '/';
83
+ foreach ( $this->subclasses as $class ) {
84
+ require( $path . $class . '.php' );
85
+ }
86
+ }
87
+
88
+ // Initialize each subclass
89
+ foreach ( $this->subclasses as $class ) {
90
+ $full = "CSSCompression_$class";
91
+ $this->$class = new $full( $this );
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Control access to properties
97
+ *
98
+ * - Getting stats/mode/css returns the current value of that property
99
+ * - Getting options will return the current full options array
100
+ * - Getting anything else returns that current value in the options array or NULL
101
+ *
102
+ * @param (string) name: Name of property that you want to access
103
+ */
104
+ public function get( $name ) {
105
+ if ( in_array( $name, $this->getters ) ) {
106
+ return $this->$name;
107
+ }
108
+ else if ( $name == 'options' ) {
109
+ return $this->Option->options;
110
+ }
111
+ else {
112
+ return $this->Option->option( $name );
113
+ }
114
+ }
115
+
116
+ /**
117
+ * The setter method only allows access to setting values in the options array
118
+ *
119
+ * @param (string) name: Key name of the option you want to set
120
+ * @param (mixed) value: Value of the option you want to set
121
+ */
122
+ public function set( $name, $value ) {
123
+ // Allow for passing array of options to merge into current ones
124
+ if ( $name === 'options' && is_array( $value ) ) {
125
+ return $this->Option->merge( $value );
126
+ }
127
+ else if ( isset( CSSCompression::$defaults[ $name ] ) ) {
128
+ return $this->Option->option( $name, $value );
129
+ }
130
+ else {
131
+ throw new CSSCompression_Exception( "Invalid Private Access to $name in CSSCompression." );
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Merges a predefined set options
137
+ *
138
+ * @param (string) mode: Name of mode to use.
139
+ */
140
+ public function mode( $mode = NULL ) {
141
+ return $this->Options->merge( $mode );
142
+ }
143
+
144
+ /**
145
+ * Resets options to their defaults, and flushes out variables
146
+ *
147
+ * @params none
148
+ */
149
+ public function reset(){
150
+ $this->Option->reset();
151
+ return $this->flush();
152
+ }
153
+
154
+ /**
155
+ * Cleans out class variables for next run
156
+ *
157
+ * @params none
158
+ */
159
+ public function flush(){
160
+ $this->css = '';
161
+ $this->stats = array(
162
+ 'before' => array(
163
+ 'props' => 0,
164
+ 'selectors' => 0,
165
+ 'size' => 0,
166
+ 'time' => 0,
167
+ ),
168
+ 'after' => array(
169
+ 'props' => 0,
170
+ 'selectors' => 0,
171
+ 'size' => 0,
172
+ 'time' => 0,
173
+ ),
174
+ );
175
+
176
+ return true;
177
+ }
178
+
179
+ /**
180
+ * Proxy to run Compression on the sheet passed. Handle options here.
181
+ *
182
+ * @param (string) css: Stylesheet to be compressed
183
+ * @param (mixed) options: Array of options or mode to use.
184
+ */
185
+ public function compress( $css = NULL, $options = NULL ) {
186
+ // Flush out old stats and variables
187
+ $this->flush();
188
+
189
+ // If no additional options, just run compression
190
+ if ( $options === NULL ) {
191
+ return $this->css = $this->Compress->compress( $css );
192
+ }
193
+
194
+ // Store old params
195
+ $old = $this->mode == '__custom' ? $this->Option->option() : $this->mode;
196
+ $readability = $this->Option->option( 'readability' );
197
+
198
+ // Compress with new set of options
199
+ $this->Option->merge( $options );
200
+ $css = $this->Compress->compress( $css );
201
+
202
+ // Reset original options
203
+ $this->reset();
204
+ $this->Option->merge( $old );
205
+
206
+ // Return the compressed css
207
+ return $this->css = $css;
208
+ }
209
+
210
+ /**
211
+ * Backdoor access to subclasses
212
+ * ONLY FOR DEVELOPMENT/TESTING.
213
+ *
214
+ * @param (string) class: Name of the focus class
215
+ * @param (array) config: Contains name reference and test arguments
216
+ */
217
+ public function access( $class, $method, $args ) {
218
+ if ( $class == 'Control' ) {
219
+ return call_user_func_array( array( $class, $method ), $args );
220
+ }
221
+ else if ( strpos( $class, '.' ) !== false ) {
222
+ $parts = explode( '.', $class );
223
+ $class = $parts[ 0 ];
224
+ $subclass = $parts[ 1 ];
225
+ return $this->$class->access( $subclass, $method, $args );
226
+ }
227
+ else if ( in_array( $class, $this->subclasses ) ) {
228
+ return $this->$class->access( $method, $args );
229
+ }
230
+ else {
231
+ throw new CSSCompression_Exception( "Unknown Class Access - " . $class );
232
+ }
233
+ }
234
+ };
235
+
236
+ ?>
@@ -0,0 +1,32 @@
1
+ <?php
2
+ /**
3
+ * CSS Compressor [VERSION]
4
+ * [DATE]
5
+ * Corey Hart @ http://www.codenothing.com
6
+ */
7
+
8
+
9
+ Class CSSCompression_Exception extends Exception
10
+ {
11
+ /**
12
+ * Custom exception handler
13
+ *
14
+ * @param (string) message: Error message
15
+ * @param (int) code: Error code
16
+ * @instance (Exception Instance) previous: Previous exception
17
+ */
18
+ public function __construct( $message = 'Unknown Exception', $code = 0, Exception $previous = NULL ) {
19
+ parent::__construct( $message, $code, $previous );
20
+ }
21
+
22
+ /**
23
+ * String version of this custom exception
24
+ *
25
+ * @params none
26
+ */
27
+ public function __toString(){
28
+ return "CSSCompression Exception: [" . $this->code . "] " . $this->message . "\n";
29
+ }
30
+ };
31
+
32
+ ?>
@@ -0,0 +1,187 @@
1
+ <?php
2
+ /**
3
+ * CSS Compressor [VERSION]
4
+ * [DATE]
5
+ * Corey Hart @ http://www.codenothing.com
6
+ */
7
+
8
+ Class CSSCompression_Format
9
+ {
10
+ /**
11
+ * Format Patterns
12
+ *
13
+ * @class Control: Compression Controller
14
+ * @param (string) token: Copy of the injection token
15
+ * @param (array) options: Reference to options
16
+ * @param (regex) rsemicolon: Checks for semicolon without an escape '\' character before it
17
+ * @param (regex) rcolon: Checks for colon without an escape '\' character before it
18
+ * @param (array) readability: Mapping to readability functions
19
+ */
20
+ private $Control;
21
+ private $token = '';
22
+ private $options = array();
23
+ private $rsemicolon = "/(?<!\\\);/";
24
+ private $rcolon = "/(?<!\\\):/";
25
+ private $readability = array(
26
+ CSSCompression::READ_MAX => 'maximum',
27
+ CSSCompression::READ_MED => 'medium',
28
+ CSSCompression::READ_MIN => 'minimum',
29
+ CSSCompression::READ_NONE => 'none',
30
+ );
31
+
32
+ /**
33
+ * Stash a reference to the controller on each instantiation
34
+ *
35
+ * @param (class) control: CSSCompression Controller
36
+ */
37
+ public function __construct( CSSCompression_Control $control ) {
38
+ $this->Control = $control;
39
+ $this->token = CSSCompression::TOKEN;
40
+ $this->options = &$control->Option->options;
41
+ }
42
+
43
+
44
+ /**
45
+ * Reformats compressed CSS into specified format
46
+ *
47
+ * @param (int) readability: Readability level of compressed output
48
+ * @param (array) selectors: Array of selectors
49
+ * @param (array) details: Array of declarations
50
+ */
51
+ public function readability( $readability = CSSCompression::READ_NONE, $selectors = array(), $details = array() ) {
52
+ if ( isset( $this->readability[ $readability ] ) ) {
53
+ $fn = $this->readability[ $readability ];
54
+ return trim( $this->$fn( $selectors, $details ) );
55
+ }
56
+ else {
57
+ return 'Invalid Readability Value';
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Returns maxium readability, breaking on every selector, brace, and property
63
+ *
64
+ * @param (array) selectors: Array of selectors
65
+ * @param (array) details: Array of declarations
66
+ */
67
+ private function maximum( $selectors, $details ) {
68
+ $css = '';
69
+ foreach ( $selectors as $k => $v ) {
70
+ if ( strpos( $v, $this->token ) === 0 ) {
71
+ $css .= substr( $v, strlen( $this->token ) );
72
+ $css .= $details[ $k ];
73
+ continue;
74
+ }
75
+ else if ( ! $details[ $k ] || trim( $details[ $k ] ) == '' ) {
76
+ continue;
77
+ }
78
+
79
+ $v = str_replace( '>', ' > ', $v );
80
+ $v = str_replace( '+', ' + ', $v );
81
+ $v = str_replace( ',', ', ', $v );
82
+ $css .= "$v {\n";
83
+ $arr = preg_split( $this->rsemicolon, $details[ $k ] );
84
+
85
+ foreach ( $arr as $item ) {
86
+ if ( ! $item ) {
87
+ continue;
88
+ }
89
+
90
+ list( $prop, $val ) = preg_split( $this->rcolon, $item, 2 );
91
+ $css .= "\t$prop: $val;\n";
92
+ }
93
+
94
+ // Kill that last semicolon at users request
95
+ if ( $this->options['unnecessary-semicolons'] ) {
96
+ $css = preg_replace( "/;\n$/", "\n", $css );
97
+ }
98
+
99
+ $css .= "}\n\n";
100
+ }
101
+
102
+ return $css;
103
+ }
104
+
105
+ /**
106
+ * Returns medium readability, putting selectors and rule sets on new lines
107
+ *
108
+ * @param (array) selectors: Array of selectors
109
+ * @param (array) details: Array of declarations
110
+ */
111
+ private function medium( $selectors, $details ) {
112
+ $css = '';
113
+ foreach ( $selectors as $k => $v ) {
114
+ if ( strpos( $v, $this->token ) === 0 ) {
115
+ $css .= substr( $v, strlen( $this->token ) );
116
+ $css .= $details[ $k ];
117
+ continue;
118
+ }
119
+ else if ( $details[ $k ] && $details[ $k ] != '' ) {
120
+ $css .= "$v {\n\t" . $details[ $k ] . "\n}\n";
121
+ }
122
+ }
123
+
124
+ return $css;
125
+ }
126
+
127
+ /**
128
+ * Returns minimum readability, breaking after every selector and it's rule set
129
+ *
130
+ * @param (array) selectors: Array of selectors
131
+ * @param (array) details: Array of declarations
132
+ */
133
+ private function minimum( $selectors, $details ) {
134
+ $css = '';
135
+ foreach ( $selectors as $k => $v ) {
136
+ if ( strpos( $v, $this->token ) === 0 ) {
137
+ $css .= substr( $v, strlen( $this->token ) );
138
+ $css .= $details[ $k ];
139
+ continue;
140
+ }
141
+ else if ( $details[ $k ] && $details[ $k ] != '' ) {
142
+ $css .= "$v{" . $details[ $k ] . "}\n";
143
+ }
144
+ }
145
+
146
+ return $css;
147
+ }
148
+
149
+ /**
150
+ * Returns an unreadable, but fully compressed script
151
+ *
152
+ * @param (array) selectors: Array of selectors
153
+ * @param (array) details: Array of declarations
154
+ */
155
+ private function none( $selectors, $details ) {
156
+ $css = '';
157
+ foreach ( $selectors as $k => $v ) {
158
+ if ( strpos( $v, $this->token ) === 0 ) {
159
+ $css .= substr( $v, strlen( $this->token ) );
160
+ $css .= $details[ $k ];
161
+ continue;
162
+ }
163
+ else if ( $details[ $k ] && $details[ $k ] != '' ) {
164
+ $css .= trim( "$v{" . $details[ $k ] . "}" );
165
+ }
166
+ }
167
+
168
+ return $css;
169
+ }
170
+
171
+ /**
172
+ * Access to private methods for testing
173
+ *
174
+ * @param (string) method: Method to be called
175
+ * @param (array) args: Array of paramters to be passed in
176
+ */
177
+ public function access( $method, $args ) {
178
+ if ( method_exists( $this, $method ) ) {
179
+ return call_user_func_array( array( $this, $method ), $args );
180
+ }
181
+ else {
182
+ throw new CSSCompression_Exception( "Unknown method in Format Class - " . $method );
183
+ }
184
+ }
185
+ };
186
+
187
+ ?>