rack-less 2.0.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/.gitignore +5 -4
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +15 -19
  4. data/README.rdoc +9 -7
  5. data/Rakefile +3 -3
  6. data/lib/rack/less/base.rb +1 -1
  7. data/lib/rack/less/config.rb +1 -1
  8. data/lib/rack/less/response.rb +4 -4
  9. data/lib/rack/less/source.rb +6 -1
  10. data/lib/rack/less/version.rb +2 -2
  11. data/rack-less.gemspec +4 -3
  12. data/test/app_helper.rb +3 -3
  13. data/test/bootstrap_test.rb +26 -0
  14. data/test/config_test.rb +112 -150
  15. data/test/fixtures/bootstrap_v1.1.0/bootstrap-1.1.0.css +1894 -0
  16. data/test/fixtures/bootstrap_v1.1.0/bootstrap.less +23 -0
  17. data/test/fixtures/bootstrap_v1.1.0/forms.less +369 -0
  18. data/test/fixtures/bootstrap_v1.1.0/patterns.less +683 -0
  19. data/test/fixtures/bootstrap_v1.1.0/preboot.less +267 -0
  20. data/test/fixtures/bootstrap_v1.1.0/reset.less +21 -0
  21. data/test/fixtures/bootstrap_v1.1.0/scaffolding.less +174 -0
  22. data/test/fixtures/bootstrap_v1.1.0/tables.less +148 -0
  23. data/test/fixtures/bootstrap_v1.1.0/type.less +185 -0
  24. data/test/fixtures/sinatra/app/stylesheets/all_compiled.css +7 -3
  25. data/test/fixtures/sinatra/app/stylesheets/nested/file_compiled.css +6 -2
  26. data/test/fixtures/sinatra/app/stylesheets/nested/nested_import.less +3 -0
  27. data/test/fixtures/sinatra/app/stylesheets/nested/really/really.less +5 -3
  28. data/test/fixtures/sinatra/app/stylesheets/nested/really/really_compiled.css +7 -2
  29. data/test/fixtures/sinatra/app/stylesheets/nested/really/really_nested_import.less +4 -0
  30. data/test/fixtures/sinatra/app/stylesheets/normal.less +1 -1
  31. data/test/fixtures/sinatra/app/stylesheets/normal_compiled.css +6 -2
  32. data/test/helper.rb +35 -38
  33. data/test/irb.rb +9 -0
  34. data/test/options_test.rb +25 -22
  35. data/test/request_test.rb +86 -74
  36. data/test/response_test.rb +6 -4
  37. data/test/sinatra_test.rb +38 -37
  38. data/test/source_test.rb +128 -114
  39. metadata +57 -34
  40. data/.bundle/config +0 -2
  41. data/test/env.rb +0 -9
@@ -0,0 +1,267 @@
1
+ /* Preboot.less
2
+ * Variables and mixins to pre-ignite any new web development project
3
+ * ------------------------------------------------------------------ */
4
+
5
+
6
+ // VARIABLES
7
+ // ---------
8
+
9
+ // Links
10
+ @linkColor: #0069d6;
11
+ @linkColorHover: darken(@linkColor, 10);
12
+
13
+ // Grays
14
+ @black: #000;
15
+ @grayDark: lighten(@black, 25%);
16
+ @gray: lighten(@black, 50%);
17
+ @grayLight: lighten(@black, 75%);
18
+ @grayLighter: lighten(@black, 90%);
19
+ @white: #fff;
20
+
21
+ // Accent Colors
22
+ @blue: #049CDB;
23
+ @blueDark: #0064CD;
24
+ @green: #46a546;
25
+ @red: #9d261d;
26
+ @yellow: #ffc40d;
27
+ @orange: #f89406;
28
+ @pink: #c3325f;
29
+ @purple: #7a43b6;
30
+
31
+ // Baseline grid
32
+ @basefont: 13px;
33
+ @baseline: 18px;
34
+
35
+ // Griditude
36
+ @gridColumns: 16;
37
+ @gridColumnWidth: 40px;
38
+ @gridGutterWidth: 20px;
39
+ @siteWidth: (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1));
40
+
41
+ // Color Scheme
42
+ @baseColor: @blue; // Set a base color
43
+ @complement: spin(@baseColor, 180); // Determine a complementary color
44
+ @split1: spin(@baseColor, 158); // Split complements
45
+ @split2: spin(@baseColor, -158);
46
+ @triad1: spin(@baseColor, 135); // Triads colors
47
+ @triad2: spin(@baseColor, -135);
48
+ @tetra1: spin(@baseColor, 90); // Tetra colors
49
+ @tetra2: spin(@baseColor, -90);
50
+ @analog1: spin(@baseColor, 22); // Analogs colors
51
+ @analog2: spin(@baseColor, -22);
52
+
53
+
54
+ // MIXINS
55
+ // ------
56
+
57
+ // Clearfix for clearing floats like a boss h5bp.com/q
58
+ .clearfix {
59
+ zoom: 1;
60
+ &:before, &:after {
61
+ display: table;
62
+ content: "";
63
+ }
64
+ &:after {
65
+ clear: both;
66
+ }
67
+ }
68
+
69
+ // Center-align a block level element
70
+ .center-block {
71
+ display: block;
72
+ margin: 0 auto;
73
+ }
74
+
75
+ // Sizing shortcuts
76
+ .size(@height: 5px, @width: 5px) {
77
+ height: @height;
78
+ width: @width;
79
+ }
80
+ .square(@size: 5px) {
81
+ .size(@size, @size);
82
+ }
83
+
84
+ // Input placeholder text
85
+ .placeholder(@color: @grayLight) {
86
+ :-moz-placeholder {
87
+ color: @color;
88
+ }
89
+ ::-webkit-input-placeholder {
90
+ color: @color;
91
+ }
92
+ }
93
+
94
+ // Font Stacks
95
+ #font {
96
+ .shorthand(@weight: normal, @size: 14px, @lineHeight: 20px) {
97
+ font-size: @size;
98
+ font-weight: @weight;
99
+ line-height: @lineHeight;
100
+ }
101
+ .sans-serif(@weight: normal, @size: 14px, @lineHeight: 20px) {
102
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
103
+ font-size: @size;
104
+ font-weight: @weight;
105
+ line-height: @lineHeight;
106
+ }
107
+ .serif(@weight: normal, @size: 14px, @lineHeight: 20px) {
108
+ font-family: "Georgia", Times New Roman, Times, serif;
109
+ font-size: @size;
110
+ font-weight: @weight;
111
+ line-height: @lineHeight;
112
+ }
113
+ .monospace(@weight: normal, @size: 12px, @lineHeight: 20px) {
114
+ font-family: "Monaco", Courier New, monospace;
115
+ font-size: @size;
116
+ font-weight: @weight;
117
+ line-height: @lineHeight;
118
+ }
119
+ }
120
+
121
+ // Grid System
122
+ .container {
123
+ width: @siteWidth;
124
+ margin: 0 auto;
125
+ .clearfix();
126
+ }
127
+ .columns(@columnSpan: 1) {
128
+ float: left;
129
+ width: (@gridColumnWidth * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1));
130
+ margin-left: @gridGutterWidth;
131
+ &:first-child {
132
+ margin-left: 0;
133
+ }
134
+ }
135
+ .offsetMath(@extraSpace: 40px) {
136
+ margin-left: (@gridColumnWidth * @columnOffset) + (@gridGutterWidth * (@columnOffset - 1)) + @extraSpace !important;
137
+ }
138
+ .offset(@columnOffset: 1) {
139
+ .offsetMath(40px);
140
+ &:first-child {
141
+ .offsetMath(20px);
142
+ }
143
+ }
144
+
145
+ // Border Radius
146
+ .border-radius(@radius: 5px) {
147
+ -webkit-border-radius: @radius;
148
+ -moz-border-radius: @radius;
149
+ border-radius: @radius;
150
+ }
151
+
152
+ // Drop shadows
153
+ .box-shadow(@shadow: 0 1px 3px rgba(0,0,0,.25)) {
154
+ -webkit-box-shadow: @shadow;
155
+ -moz-box-shadow: @shadow;
156
+ box-shadow: @shadow;
157
+ }
158
+
159
+ // Transitions
160
+ .transition(@transition) {
161
+ -webkit-transition: @transition;
162
+ -moz-transition: @transition;
163
+ transition: @transition;
164
+ }
165
+
166
+ // Background clipping
167
+ .background-clip(@clip) {
168
+ -webkit-background-clip: @clip;
169
+ -moz-background-clip: @clip;
170
+ background-clip: @clip;
171
+ }
172
+
173
+ // CSS3 Content Columns
174
+ .content-columns(@columnCount, @columnGap: 20px) {
175
+ -webkit-column-count: @columnCount;
176
+ -moz-column-count: @columnCount;
177
+ column-count: @columnCount;
178
+ -webkit-column-gap: @columnGap;
179
+ -moz-column-gap: @columnGap;
180
+ column-gap: @columnGap;
181
+ }
182
+
183
+ // Buttons
184
+ // .button(@color: #fff, @padding: 4px 14px, @textColor: #333, @textShadow: 0 1px 1px rgba(255,255,255,.75), @fontSize: 13px, @borderColor: rgba(0,0,0,.1), @borderRadius: 4px) {
185
+ // display: inline-block;
186
+ // #gradient > .vertical-three-colors(@color, @color, 0.25, darken(@color, 10%));
187
+ // padding: @padding;
188
+ // text-shadow: @textShadow;
189
+ // color: @textColor;
190
+ // font-size: @fontSize;
191
+ // line-height: @baseline;
192
+ // border: 1px solid;
193
+ // border-color: #ccc #ccc #bbb;
194
+ // border-color: borderColor borderColor fadein(@borderColor, 15%);
195
+ // .border-radius(@borderRadius);
196
+ // @shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
197
+ // .box-shadow(@shadow);
198
+ // &:hover {
199
+ // background-position: 0 -15px;
200
+ // color: @textColor;
201
+ // text-decoration: none;
202
+ // }
203
+ // }
204
+
205
+ // Add an alphatransparency value to any background or border color (via Elyse Holladay)
206
+ #translucent {
207
+ .background(@color: @white, @alpha: 1) {
208
+ background-color: hsla(hue(@color), saturation(@color), lightness(@color), @alpha);
209
+ }
210
+ .border(@color: @white, @alpha: 1) {
211
+ border-color: hsla(hue(@color), saturation(@color), lightness(@color), @alpha);
212
+ background-clip: padding-box;
213
+ }
214
+ }
215
+
216
+ // Gradients
217
+ #gradient {
218
+ .horizontal (@startColor: #555, @endColor: #333) {
219
+ background-color: @endColor;
220
+ background-repeat: repeat-x;
221
+ background-image: -khtml-gradient(linear, left top, right top, from(@startColor), to(@endColor)); // Konqueror
222
+ background-image: -moz-linear-gradient(left, @startColor, @endColor); // FF 3.6+
223
+ background-image: -ms-linear-gradient(left, @startColor, @endColor); // IE10
224
+ background-image: -webkit-gradient(linear, left top, right top, color-stop(0%, @startColor), color-stop(100%, @endColor)); // Safari 4+, Chrome 2+
225
+ background-image: -webkit-linear-gradient(left, @startColor, @endColor); // Safari 5.1+, Chrome 10+
226
+ background-image: -o-linear-gradient(left, @startColor, @endColor); // Opera 11.10
227
+ background-image: linear-gradient(left, @startColor, @endColor); // Le standard
228
+ }
229
+ .vertical (@startColor: #555, @endColor: #333) {
230
+ background-color: @endColor;
231
+ background-repeat: repeat-x;
232
+ background-image: -khtml-gradient(linear, left top, left bottom, from(@startColor), to(@endColor)); // Konqueror
233
+ background-image: -moz-linear-gradient(@startColor, @endColor); // FF 3.6+
234
+ background-image: -ms-linear-gradient(@startColor, @endColor); // IE10
235
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @startColor), color-stop(100%, @endColor)); // Safari 4+, Chrome 2+
236
+ background-image: -webkit-linear-gradient(@startColor, @endColor); // Safari 5.1+, Chrome 10+
237
+ background-image: -o-linear-gradient(@startColor, @endColor); // Opera 11.10
238
+ background-image: linear-gradient(@startColor, @endColor); // The standard
239
+ }
240
+ .directional (@startColor: #555, @endColor: #333, @deg: 45deg) {
241
+ background-color: @endColor;
242
+ background-repeat: repeat-x;
243
+ background-image: -moz-linear-gradient(@deg, @startColor, @endColor); // FF 3.6+
244
+ background-image: -ms-linear-gradient(@deg, @startColor, @endColor); // IE10
245
+ background-image: -webkit-linear-gradient(@deg, @startColor, @endColor); // Safari 5.1+, Chrome 10+
246
+ background-image: -o-linear-gradient(@deg, @startColor, @endColor); // Opera 11.10
247
+ background-image: linear-gradient(@deg, @startColor, @endColor); // The standard
248
+ }
249
+ .vertical-three-colors(@startColor: #00b3ee, @midColor: #7a43b6, @colorStop: 50%, @endColor: #c3325f) {
250
+ background-color: @endColor;
251
+ background-repeat: no-repeat;
252
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), color-stop(@colorStop, @midColor), to(@endColor));
253
+ background-image: -webkit-linear-gradient(@startColor, @midColor @colorStop, @endColor);
254
+ background-image: -moz-linear-gradient(@startColor, @midColor @colorStop, @endColor);
255
+ background-image: -ms-linear-gradient(@startColor, @midColor @colorStop, @endColor);
256
+ background-image: -o-linear-gradient(@startColor, @midColor @colorStop, @endColor);
257
+ background-image: linear-gradient(@startColor, @midColor @colorStop, @endColor);
258
+ }
259
+ }
260
+
261
+ // Opacity
262
+ .opacity(@opacity: 100) {
263
+ filter: e(%("alpha(opacity=%d)", @opacity));
264
+ -khtml-opacity: @opacity / 100;
265
+ -moz-opacity: @opacity / 100;
266
+ opacity: @opacity / 100;
267
+ }
@@ -0,0 +1,21 @@
1
+ /* Reset.less
2
+ * Props to Eric Meyer (meyerweb.com) for his CSS reset file. We're using an adapted version here that cuts out some of the reset HTML elements we will never need here (i.e., dfn, samp, etc).
3
+ * ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
4
+
5
+
6
+ // ERIC MEYER RESET
7
+ // ----------------
8
+
9
+ html, body { margin: 0; padding: 0; }
10
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, cite, code, del, dfn, em, img, q, s, samp, small, strike, strong, sub, sup, tt, var, dd, dl, dt, li, ol, ul, fieldset, form, label, legend, button, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; font-weight: normal; font-style: normal; font-size: 100%; line-height: 1; font-family: inherit; }
11
+ table { border-collapse: collapse; border-spacing: 0; }
12
+ ol, ul { list-style: none; }
13
+ q:before, q:after, blockquote:before, blockquote:after { content: ""; }
14
+
15
+
16
+ // HTML5
17
+ // -----
18
+
19
+ header, section, footer, article, aside {
20
+ display: block;
21
+ }
@@ -0,0 +1,174 @@
1
+ /*
2
+ * Scaffolding
3
+ * Basic and global styles for generating a grid system, structural layout, and page templates
4
+ * ------------------------------------------------------------------------------------------- */
5
+
6
+
7
+ // GRID SYSTEM
8
+ // -----------
9
+
10
+ .row {
11
+ .clearfix();
12
+
13
+ // Default columns
14
+ .span1 { .columns(1); }
15
+ .span2 { .columns(2); }
16
+ .span3 { .columns(3); }
17
+ .span4 { .columns(4); }
18
+ .span5 { .columns(5); }
19
+ .span6 { .columns(6); }
20
+ .span7 { .columns(7); }
21
+ .span8 { .columns(8); }
22
+ .span9 { .columns(9); }
23
+ .span10 { .columns(10); }
24
+ .span11 { .columns(11); }
25
+ .span12 { .columns(12); }
26
+ .span13 { .columns(13); }
27
+ .span14 { .columns(14); }
28
+ .span15 { .columns(15); }
29
+ .span16 { .columns(16); }
30
+
31
+ // Offset column options
32
+ .offset1 { .offset(1); }
33
+ .offset2 { .offset(2); }
34
+ .offset3 { .offset(3); }
35
+ .offset4 { .offset(4); }
36
+ .offset5 { .offset(5); }
37
+ .offset6 { .offset(6); }
38
+ .offset7 { .offset(7); }
39
+ .offset8 { .offset(8); }
40
+ .offset9 { .offset(8); }
41
+ .offset10 { .offset(10); }
42
+ .offset11 { .offset(11); }
43
+ .offset12 { .offset(12); }
44
+ }
45
+
46
+
47
+ // STRUCTURAL LAYOUT
48
+ // -----------------
49
+
50
+ html, body {
51
+ background-color: #fff;
52
+ }
53
+ body {
54
+ margin: 0;
55
+ #font > .sans-serif(normal,@basefont,@baseline);
56
+ color: @gray;
57
+ text-rendering: optimizeLegibility;
58
+ }
59
+
60
+ // Container (centered, fixed-width layouts)
61
+ div.container {
62
+ width: 940px;
63
+ margin: 0 auto;
64
+ }
65
+
66
+ // Fluid layouts (left aligned, with sidebar, min- & max-width content)
67
+ div.container-fluid {
68
+ padding: 0 20px;
69
+ .clearfix();
70
+ div.sidebar {
71
+ float: left;
72
+ width: 220px;
73
+ }
74
+ div.content {
75
+ min-width: 700px;
76
+ max-width: 1180px;
77
+ margin-left: 240px;
78
+ }
79
+ }
80
+
81
+
82
+ // BASE STYLES
83
+ // -----------
84
+
85
+ // Links
86
+ a {
87
+ color: @linkColor;
88
+ text-decoration: none;
89
+ line-height: inherit;
90
+ font-weight: inherit;
91
+ &:hover {
92
+ color: @linkColorHover;
93
+ text-decoration: underline;
94
+ }
95
+ }
96
+
97
+ // Buttons
98
+ .btnColor(@primaryColor, @secondaryColor) {
99
+ #gradient > .vertical(@primaryColor, @secondaryColor);
100
+ text-shadow: 0 -1px 0 rgba(0,0,0,.25);
101
+ border-color: @secondaryColor @secondaryColor darken(@secondaryColor, 15%);
102
+ border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%);
103
+ }
104
+
105
+ .btn {
106
+ // .button(#1174C6);
107
+ cursor: pointer;
108
+ display: inline-block;
109
+ #gradient > .vertical-three-colors(#fff, #fff, 0.25, darken(#fff, 10%));
110
+ padding: 4px 14px;
111
+ text-shadow: 0 1px 1px rgba(255,255,255,.75);
112
+ color: #333;
113
+ font-size: 13px;
114
+ line-height: @baseline;
115
+ border: 1px solid #ccc;
116
+ border-bottom-color: #bbb;
117
+ .border-radius(4px);
118
+ @shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
119
+ .box-shadow(@shadow);
120
+ &:hover {
121
+ background-position: 0 -15px;
122
+ color: #333;
123
+ text-decoration: none;
124
+ }
125
+ .transition(.1s linear all);
126
+ &.primary,
127
+ &.danger {
128
+ color: #fff;
129
+ &:hover {
130
+ color: #fff;
131
+ }
132
+ }
133
+ &.primary {
134
+ .btnColor(@blue, @blueDark)
135
+ }
136
+ &.danger {
137
+ .btnColor(lighten(@red, 15%), @red)
138
+ }
139
+ &.large {
140
+ font-size: 16px;
141
+ line-height: 28px;
142
+ .border-radius(6px);
143
+ }
144
+ &.small {
145
+ padding-right: 9px;
146
+ padding-left: 9px;
147
+ font-size: 11px;
148
+ }
149
+ &.disabled {
150
+ background-image: none;
151
+ .opacity(65);
152
+ cursor: default;
153
+ }
154
+
155
+ // this can't be included with the .disabled def because IE8 and below will drop it ;_;
156
+ &:disabled {
157
+ background-image: none;
158
+ .opacity(65);
159
+ cursor: default;
160
+ }
161
+ &:active {
162
+ @shadow: inset 0 3px 7px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.05);
163
+ .box-shadow(@shadow);
164
+ }
165
+ }
166
+
167
+ // Help Firefox not be a jerk about adding extra padding to buttons
168
+ button.btn,
169
+ input[type=submit].btn {
170
+ &::-moz-focus-inner {
171
+ padding: 0;
172
+ border: 0;
173
+ }
174
+ }