arnebrasseur-compass 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +160 -0
- data/README.markdown +18 -0
- data/Rakefile +112 -0
- data/VERSION +1 -0
- data/bin/compass +8 -0
- data/compass.gemspec +37 -0
- data/examples/blueprint_default/index.html +73 -0
- data/examples/blueprint_default/parts/elements.html +246 -0
- data/examples/blueprint_default/parts/forms.html +100 -0
- data/examples/blueprint_default/parts/grid.html +206 -0
- data/examples/blueprint_default/parts/test-small.jpg +0 -0
- data/examples/blueprint_default/parts/test.jpg +0 -0
- data/examples/blueprint_default/parts/valid.png +0 -0
- data/examples/blueprint_default/stylesheets/ie.sass +3 -0
- data/examples/blueprint_default/stylesheets/images/grid.png +0 -0
- data/examples/blueprint_default/stylesheets/print.sass +3 -0
- data/examples/blueprint_default/stylesheets/screen.sass +8 -0
- data/examples/blueprint_plugins/index.html +60 -0
- data/examples/blueprint_plugins/parts/fancy_type.html +84 -0
- data/examples/blueprint_plugins/parts/test-small.jpg +0 -0
- data/examples/blueprint_plugins/parts/test.jpg +0 -0
- data/examples/blueprint_plugins/parts/valid.png +0 -0
- data/examples/blueprint_plugins/stylesheets/ie.sass +3 -0
- data/examples/blueprint_plugins/stylesheets/images/grid.png +0 -0
- data/examples/blueprint_plugins/stylesheets/print.sass +3 -0
- data/examples/blueprint_plugins/stylesheets/screen.sass +11 -0
- data/examples/blueprint_scoped/stylesheets/ie.sass +3 -0
- data/examples/blueprint_scoped/stylesheets/print.sass +3 -0
- data/examples/blueprint_scoped/stylesheets/screen.sass +4 -0
- data/examples/blueprint_scoped_form/stylesheets/ie.sass +3 -0
- data/examples/blueprint_scoped_form/stylesheets/print.sass +3 -0
- data/examples/blueprint_scoped_form/stylesheets/screen.sass +10 -0
- data/examples/blueprint_semantic/index.html +68 -0
- data/examples/blueprint_semantic/parts/fancy_type.html +84 -0
- data/examples/blueprint_semantic/parts/liquid.html +84 -0
- data/examples/blueprint_semantic/parts/test-small.jpg +0 -0
- data/examples/blueprint_semantic/parts/test.jpg +0 -0
- data/examples/blueprint_semantic/parts/valid.png +0 -0
- data/examples/blueprint_semantic/stylesheets/ie.sass +3 -0
- data/examples/blueprint_semantic/stylesheets/images/grid.png +0 -0
- data/examples/blueprint_semantic/stylesheets/liquid.sass +70 -0
- data/examples/blueprint_semantic/stylesheets/print.sass +3 -0
- data/examples/blueprint_semantic/stylesheets/screen.sass +69 -0
- data/examples/compass/compass.html +19 -0
- data/examples/compass/sticky_footer.html.haml +14 -0
- data/examples/compass/stylesheets/compass.sass +47 -0
- data/examples/compass/stylesheets/images/blue_arrow.gif +0 -0
- data/examples/compass/stylesheets/sticky_footer.sass +11 -0
- data/examples/compass/stylesheets/utilities.sass +65 -0
- data/examples/compass/utilities.html.haml +136 -0
- data/examples/yui/divisions.html.haml +179 -0
- data/examples/yui/index.html.haml +19 -0
- data/examples/yui/stylesheets/screen.sass +13 -0
- data/examples/yui/sub_divisions.html.haml +169 -0
- data/examples/yui/templates.html.haml +54 -0
- data/examples/yui/test.jpg +0 -0
- data/examples/yui/typography.html.haml +132 -0
- data/frameworks/blueprint/lib/blueprint/constants.rb +17 -0
- data/frameworks/blueprint/lib/blueprint/grid_builder.rb +54 -0
- data/frameworks/blueprint/stylesheets/_blueprint.sass +3 -0
- data/frameworks/blueprint/stylesheets/blueprint/_ie.sass +49 -0
- data/frameworks/blueprint/stylesheets/blueprint/_print.sass +82 -0
- data/frameworks/blueprint/stylesheets/blueprint/_screen.sass +15 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass +30 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass +9 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +81 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +43 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +141 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass +58 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass +137 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +46 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +153 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass +37 -0
- data/frameworks/blueprint/templates/project/grid.png +0 -0
- data/frameworks/blueprint/templates/project/ie.sass +3 -0
- data/frameworks/blueprint/templates/project/print.sass +3 -0
- data/frameworks/blueprint/templates/project/screen.sass +8 -0
- data/frameworks/compass/stylesheets/_compass.sass +1 -0
- data/frameworks/compass/stylesheets/compass/_layout.sass +1 -0
- data/frameworks/compass/stylesheets/compass/_reset.sass +3 -0
- data/frameworks/compass/stylesheets/compass/_utilities.sass +5 -0
- data/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass +17 -0
- data/frameworks/compass/stylesheets/compass/utilities/_general.sass +4 -0
- data/frameworks/compass/stylesheets/compass/utilities/_links.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/_lists.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/_print.sass +24 -0
- data/frameworks/compass/stylesheets/compass/utilities/_tables.sass +1 -0
- data/frameworks/compass/stylesheets/compass/utilities/_text.sass +2 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass +11 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass +6 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +58 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass +0 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass +19 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass +5 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass +24 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass +5 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass +21 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass +20 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass +29 -0
- data/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass +25 -0
- data/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +10 -0
- data/frameworks/compass/templates/project/grid.png +0 -0
- data/frameworks/compass/templates/project/ie.sass +3 -0
- data/frameworks/compass/templates/project/print.sass +4 -0
- data/frameworks/compass/templates/project/screen.sass +4 -0
- data/frameworks/yui/COPYRIGHT +15 -0
- data/frameworks/yui/stylesheets/_yui.sass +7 -0
- data/frameworks/yui/stylesheets/yui/modules/_base.sass +60 -0
- data/frameworks/yui/stylesheets/yui/modules/_fonts.sass +38 -0
- data/frameworks/yui/stylesheets/yui/modules/_grids.sass +341 -0
- data/frameworks/yui/templates/project/screen.sass +4 -0
- data/lib/compass/commands/base.rb +94 -0
- data/lib/compass/commands/create_project.rb +32 -0
- data/lib/compass/commands/install_rails.rb +115 -0
- data/lib/compass/commands/print_version.rb +23 -0
- data/lib/compass/commands/update_project.rb +101 -0
- data/lib/compass/commands/watch_project.rb +42 -0
- data/lib/compass/core_ext.rb +39 -0
- data/lib/compass/exec.rb +164 -0
- data/lib/compass/frameworks/blueprint.rb +2 -0
- data/lib/compass/frameworks/compass.rb +2 -0
- data/lib/compass/frameworks/yui.rb +2 -0
- data/lib/compass/frameworks.rb +27 -0
- data/lib/compass/merb.rb +43 -0
- data/lib/compass/test_case.rb +37 -0
- data/lib/compass/validate/COPYRIGHT.html +93 -0
- data/lib/compass/validate/JIGSAW_COPYRIGHT +64 -0
- data/lib/compass/validate/README.html +83 -0
- data/lib/compass/validate/XERCES_COPYING.txt +56 -0
- data/lib/compass/validate/css-validator-javadoc.jar +0 -0
- data/lib/compass/validate/css-validator.jar +0 -0
- data/lib/compass/validate/jigsaw.jar +0 -0
- data/lib/compass/validate/xerces.jar +0 -0
- data/lib/compass/validate.rb +13 -0
- data/lib/compass/validator.rb +59 -0
- data/lib/compass/version.rb +48 -0
- data/lib/compass.rb +20 -0
- data/lib/sass_extensions.rb +13 -0
- data/test/compass_test.rb +152 -0
- data/test/fixtures/stylesheets/blueprint/css/typography.css +158 -0
- data/test/fixtures/stylesheets/blueprint/sass/ie.sass +3 -0
- data/test/fixtures/stylesheets/blueprint/sass/print.sass +3 -0
- data/test/fixtures/stylesheets/blueprint/sass/screen.sass +17 -0
- data/test/fixtures/stylesheets/blueprint/sass/typography.sass +3 -0
- data/test/fixtures/stylesheets/compass/css/layout.css +14 -0
- data/test/fixtures/stylesheets/compass/css/print.css +19 -0
- data/test/fixtures/stylesheets/compass/css/reset.css +69 -0
- data/test/fixtures/stylesheets/compass/css/utilities.css +21 -0
- data/test/fixtures/stylesheets/compass/sass/layout.sass +3 -0
- data/test/fixtures/stylesheets/compass/sass/print.sass +5 -0
- data/test/fixtures/stylesheets/compass/sass/reset.sass +1 -0
- data/test/fixtures/stylesheets/compass/sass/utilities.sass +5 -0
- data/test/fixtures/stylesheets/yui/css/mixins.css +16 -0
- data/test/fixtures/stylesheets/yui/sass/base.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/fonts.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/grids.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/mixins.sass +16 -0
- data/test/sass_extensions_test.rb +26 -0
- data/test/test_helper.rb +37 -0
- metadata +264 -0
@@ -0,0 +1,341 @@
|
|
1
|
+
// This is a port of YUI Grids version 2.6.0
|
2
|
+
// Note: This is not really tested yet. Use at your own risk.
|
3
|
+
|
4
|
+
@import compass/utilities/general/clearfix.sass
|
5
|
+
@import fonts.sass
|
6
|
+
|
7
|
+
=yui-grids
|
8
|
+
+yui-grids-init
|
9
|
+
+yui-grid-templates
|
10
|
+
+yui-grid-divisions
|
11
|
+
|
12
|
+
=yui-grid-templates
|
13
|
+
#doc
|
14
|
+
+yui-document(750px)
|
15
|
+
#doc2
|
16
|
+
+yui-document(950px)
|
17
|
+
#doc3
|
18
|
+
+yui-document("fluid")
|
19
|
+
#doc4
|
20
|
+
+yui-document(974px)
|
21
|
+
.yui-t1
|
22
|
+
+yui-two-column-left-template(160px)
|
23
|
+
.yui-t2
|
24
|
+
+yui-two-column-left-template(180px)
|
25
|
+
.yui-t3
|
26
|
+
+yui-two-column-left-template(300px)
|
27
|
+
.yui-t4
|
28
|
+
+yui-two-column-right-template(180px)
|
29
|
+
.yui-t5
|
30
|
+
+yui-two-column-right-template(240px)
|
31
|
+
.yui-t6
|
32
|
+
+yui-two-column-right-template(300px)
|
33
|
+
|
34
|
+
=yui-grids-footer
|
35
|
+
clear: both
|
36
|
+
|
37
|
+
=yui-grids-body
|
38
|
+
+clearfix
|
39
|
+
|
40
|
+
=yui-grids-init(!footer = "#ft", !body = "#bd")
|
41
|
+
body
|
42
|
+
:text-align center
|
43
|
+
@if !footer
|
44
|
+
#{!footer}
|
45
|
+
+yui-grids-footer
|
46
|
+
@if !body
|
47
|
+
#{!body}
|
48
|
+
+yui-grids-body
|
49
|
+
|
50
|
+
=em-size(!style, !px_size, !base_font_size = !yui_default_base_font_size)
|
51
|
+
:#{!style}= 1em * !px_size / !base_font_size
|
52
|
+
|
53
|
+
=em-size-hacked(!style, !px_size, !base_font_size = !yui_default_base_font_size)
|
54
|
+
+em-size(!style, !px_size, !base_font_size)
|
55
|
+
+em-size("*"+!style, !px_size * 39 / 40, !base_font_size)
|
56
|
+
|
57
|
+
// All documents must have these styles. Setting a min-width is optional, but recommended. To omit it, pass false as the min_width value.
|
58
|
+
=yui-document-base(!min_width = 750px)
|
59
|
+
:margin auto
|
60
|
+
:text-align left
|
61
|
+
@if !min_width
|
62
|
+
:min-width= !min_width
|
63
|
+
|
64
|
+
=yui-block-base
|
65
|
+
:position relative
|
66
|
+
:_position static
|
67
|
+
|
68
|
+
=yui-main-block
|
69
|
+
:position static
|
70
|
+
:float none
|
71
|
+
:width auto
|
72
|
+
|
73
|
+
|
74
|
+
// Creates a fixed width document container
|
75
|
+
// Pass "fluid" for the width to create a document that grows with the width of the browser.
|
76
|
+
=yui-document(!width, !min_width = 750px, !base_font_size = !yui_default_base_font_size)
|
77
|
+
+yui-document-base(!min_width)
|
78
|
+
@if !width == "fluid"
|
79
|
+
:margin auto 10px
|
80
|
+
:width auto
|
81
|
+
@else
|
82
|
+
+em-size-hacked("width", !width, !base_font_size)
|
83
|
+
|
84
|
+
=yui-two-column-left-template(!column_width, !main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = 750px, !base_font_size = !yui_default_base_font_size)
|
85
|
+
+yui-document(!document_width, !min_width, !base_font_size)
|
86
|
+
#{!main_selector}
|
87
|
+
:width 100%
|
88
|
+
:float right
|
89
|
+
+em-size("margin-left", -!column_width - 10px, !base_font_size)
|
90
|
+
#{!block_selector}
|
91
|
+
+yui-main-block
|
92
|
+
+em-size-hacked("margin-left", !column_width, !base_font_size)
|
93
|
+
#{!block_selector}
|
94
|
+
+yui-block-base
|
95
|
+
:float left
|
96
|
+
+em-size-hacked("width", !column_width, !base_font_size)
|
97
|
+
|
98
|
+
=yui-two-column-right-template(!column_width, !main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = 750px, !base_font_size = !yui_default_base_font_size)
|
99
|
+
+yui-document(!document_width, !min_width, !base_font_size)
|
100
|
+
#{!main_selector}
|
101
|
+
:width 100%
|
102
|
+
:float left
|
103
|
+
+em-size("margin-right", -!column_width - 10px, !base_font_size)
|
104
|
+
#{!block_selector}
|
105
|
+
+yui-main-block
|
106
|
+
+em-size-hacked("margin-right", !column_width, !base_font_size)
|
107
|
+
#{!block_selector}
|
108
|
+
+yui-block-base
|
109
|
+
:float right
|
110
|
+
+em-size-hacked("width", !column_width, !base_font_size)
|
111
|
+
|
112
|
+
=yui-one-column-template(!main_selector = "#yui-main", !block_selector = ".yui-b", !document_width = 750px, !min_width = 750px, !base_font_size = !yui_default_base_font_size)
|
113
|
+
+yui-document(!document_width, !min_width, !base_font_size)
|
114
|
+
#{!main_selector}
|
115
|
+
:width 100%
|
116
|
+
#{!block_selector}
|
117
|
+
+yui-main-block
|
118
|
+
:display block
|
119
|
+
:margin 0 0 1em 0
|
120
|
+
#{!block_selector}
|
121
|
+
+yui-block-base
|
122
|
+
|
123
|
+
=yui-custom-template(!main_selector = "#yui-main", !block_selector = ".yui-b")
|
124
|
+
#{!main_selector}
|
125
|
+
:width 100%
|
126
|
+
#{!block_selector}
|
127
|
+
+yui-main-block
|
128
|
+
#{!block_selector}
|
129
|
+
+yui-block-base
|
130
|
+
|
131
|
+
=yui-grid-divisions(!unit = ".yui-u", !g_50_50 = ".yui-g", !g_33_33_33 = ".yui-gb", !g_67_33 = ".yui-gc", !g_33_67 = ".yui-gd", !g_75_25 = ".yui-ge", !g_25_75 = ".yui-gf")
|
132
|
+
#{nest(!g_50_50, !g_33_33_33, !unit)},
|
133
|
+
#{nest(!g_67_33, !unit)},
|
134
|
+
#{nest(!g_67_33, !g_50_50)},
|
135
|
+
#{nest(!g_33_67, !unit)},
|
136
|
+
#{nest(!g_33_33_33, !g_50_50)},
|
137
|
+
#{nest(!g_33_33_33, !g_33_33_33)},
|
138
|
+
#{nest(!g_33_33_33, !g_67_33)},
|
139
|
+
#{nest(!g_33_33_33, !g_33_67)},
|
140
|
+
#{nest(!g_33_33_33, !g_75_25)},
|
141
|
+
#{nest(!g_33_33_33, !g_25_75)},
|
142
|
+
#{nest(!g_33_33_33, !unit)}
|
143
|
+
float: left
|
144
|
+
margin-left: 2%
|
145
|
+
width: 32%
|
146
|
+
|
147
|
+
#{!g_33_33_33}
|
148
|
+
#{!g_33_33_33},
|
149
|
+
#{!g_67_33}
|
150
|
+
#{!unit}
|
151
|
+
*margin-left: 1.8%
|
152
|
+
_margin-left: 4%
|
153
|
+
|
154
|
+
#{nest(!g_50_50, !g_33_33_33, !unit)}
|
155
|
+
_margin-left: .8%
|
156
|
+
|
157
|
+
#{nest(!g_33_33_33, !unit)}
|
158
|
+
float: right
|
159
|
+
|
160
|
+
#{nest(!g_33_33_33, "div.first")}
|
161
|
+
margin-left: 0
|
162
|
+
float: left
|
163
|
+
|
164
|
+
#{!g_50_50},
|
165
|
+
#{!g_33_33_33}
|
166
|
+
#{!g_33_33_33}
|
167
|
+
div.first
|
168
|
+
*margin-right: 0
|
169
|
+
*width: 32%
|
170
|
+
_width: 31.7%
|
171
|
+
|
172
|
+
#{!g_33_33_33}
|
173
|
+
#{!g_67_33},
|
174
|
+
#{!g_33_67}
|
175
|
+
div.first
|
176
|
+
*margin-right: 0
|
177
|
+
|
178
|
+
#{nest(!g_33_33_33, !g_33_67, !unit)}
|
179
|
+
*width: 66%
|
180
|
+
_width: 61.2%
|
181
|
+
|
182
|
+
#{nest(!g_33_33_33, !g_33_67, "div.first")}
|
183
|
+
*width: 31%
|
184
|
+
_width: 29.5%
|
185
|
+
|
186
|
+
#{!g_50_50},
|
187
|
+
#{!g_33_33_33}
|
188
|
+
#{!g_67_33}
|
189
|
+
#{!unit}
|
190
|
+
width: 32%
|
191
|
+
_float: right
|
192
|
+
margin-right: 0
|
193
|
+
_margin-left: 0
|
194
|
+
|
195
|
+
#{nest(!g_33_33_33, !g_67_33, "div.first")}
|
196
|
+
width: 66%
|
197
|
+
*float: left
|
198
|
+
*margin-left: 0
|
199
|
+
|
200
|
+
#{!g_33_33_33}
|
201
|
+
#{!g_75_25},
|
202
|
+
#{!g_25_75}
|
203
|
+
#{!unit}
|
204
|
+
margin: 0
|
205
|
+
|
206
|
+
#{nest(!g_50_50, !unit)},
|
207
|
+
#{nest(!g_50_50, !g_50_50)},
|
208
|
+
#{nest(!g_50_50, !g_33_33_33)},
|
209
|
+
#{nest(!g_50_50, !g_67_33)},
|
210
|
+
#{nest(!g_50_50, !g_33_67)},
|
211
|
+
#{nest(!g_50_50, !g_75_25)},
|
212
|
+
#{nest(!g_50_50, !g_25_75)},
|
213
|
+
#{nest(!g_67_33, !unit)},
|
214
|
+
#{nest(!g_33_67, !g_50_50)},
|
215
|
+
#{nest(!g_50_50, !g_67_33, !unit)},
|
216
|
+
#{nest(!g_75_25, !unit)},
|
217
|
+
#{nest(!g_75_25, !g_50_50)},
|
218
|
+
#{nest(!g_25_75, !g_50_50)},
|
219
|
+
#{nest(!g_25_75, !unit)}
|
220
|
+
float: right
|
221
|
+
|
222
|
+
#{nest(!g_50_50, !g_67_33)},
|
223
|
+
#{nest(!g_50_50, !g_75_25)},
|
224
|
+
#{!g_50_50},
|
225
|
+
#{!g_67_33},
|
226
|
+
#{nest(!g_67_33, "div.first")},
|
227
|
+
#{!g_33_67},
|
228
|
+
#{!g_75_25},
|
229
|
+
#{!g_25_75}
|
230
|
+
div.first
|
231
|
+
float: left
|
232
|
+
|
233
|
+
#{!g_50_50},
|
234
|
+
#{!g_33_33_33},
|
235
|
+
#{!g_67_33},
|
236
|
+
#{!g_33_67},
|
237
|
+
#{!g_75_25},
|
238
|
+
#{!g_25_75}
|
239
|
+
#{!g_50_50}
|
240
|
+
#{!unit}
|
241
|
+
width: 49%
|
242
|
+
*width: 48.1%
|
243
|
+
*margin-left: 0
|
244
|
+
|
245
|
+
#{nest(!g_50_50, !g_50_50, "div.first")}
|
246
|
+
*margin: 0
|
247
|
+
|
248
|
+
#{nest(!g_33_33_33, !g_50_50, "div.first")}
|
249
|
+
*margin-right: 4%
|
250
|
+
_margin-right: 1.3%
|
251
|
+
|
252
|
+
#{nest(!g_33_33_33, !g_33_33_33, !unit)}
|
253
|
+
_margin-left: .7%
|
254
|
+
|
255
|
+
#{nest(!g_33_33_33, !g_50_50)},
|
256
|
+
#{nest(!g_33_33_33, !g_33_33_33)}
|
257
|
+
div.first
|
258
|
+
*margin-left: 0
|
259
|
+
|
260
|
+
#{!g_67_33},
|
261
|
+
#{!g_33_67}
|
262
|
+
#{!g_50_50}
|
263
|
+
#{!unit}
|
264
|
+
*width: 48.1%
|
265
|
+
*margin-left: 0
|
266
|
+
|
267
|
+
#{!g_50_50}
|
268
|
+
#{!unit},
|
269
|
+
#{!g_50_50},
|
270
|
+
#{!g_33_33_33},
|
271
|
+
#{!g_67_33},
|
272
|
+
#{!g_33_67},
|
273
|
+
#{!g_75_25},
|
274
|
+
#{!g_25_75}
|
275
|
+
width: 49.1%
|
276
|
+
|
277
|
+
#{nest(!g_50_50, !g_33_33_33)},
|
278
|
+
#{!g_33_33_33},
|
279
|
+
#{!g_67_33},
|
280
|
+
#{!g_33_67}
|
281
|
+
div.first
|
282
|
+
margin-left: 0
|
283
|
+
|
284
|
+
#{nest(!g_50_50, !g_67_33, "div.first")},
|
285
|
+
#{nest(!g_67_33, "div.first")},
|
286
|
+
#{nest(!g_33_67, !g_50_50)},
|
287
|
+
#{nest(!g_33_67, !unit)}
|
288
|
+
width: 66%
|
289
|
+
|
290
|
+
#{!g_33_67},
|
291
|
+
#{nest(!g_33_33_33, !g_33_67)}
|
292
|
+
div.first
|
293
|
+
width: 32%
|
294
|
+
|
295
|
+
#{nest(!g_50_50, !g_33_67, "div.first")}
|
296
|
+
_width: 29.9%
|
297
|
+
|
298
|
+
#{nest(!g_75_25, !unit)},
|
299
|
+
#{nest(!g_75_25, !g_50_50)},
|
300
|
+
#{nest(!g_25_75, "div.first")}
|
301
|
+
width: 24%
|
302
|
+
|
303
|
+
#{!g_33_33_33}
|
304
|
+
#{!g_75_25},
|
305
|
+
#{!g_25_75}
|
306
|
+
div#{!unit}
|
307
|
+
float: right
|
308
|
+
|
309
|
+
#{!g_33_33_33}
|
310
|
+
#{!g_75_25},
|
311
|
+
#{!g_25_75}
|
312
|
+
div.first
|
313
|
+
float: left
|
314
|
+
|
315
|
+
#{nest(!g_75_25, "div.first")},
|
316
|
+
#{nest(!g_25_75, !g_50_50)},
|
317
|
+
#{nest(!g_25_75, !unit)}
|
318
|
+
width: 74.2%
|
319
|
+
|
320
|
+
#{!g_33_33_33}
|
321
|
+
#{nest(!g_75_25, !unit)},
|
322
|
+
#{nest(!g_25_75, "div.first")}
|
323
|
+
*width: 24%
|
324
|
+
_width: 20%
|
325
|
+
|
326
|
+
#{!g_33_33_33}
|
327
|
+
#{nest(!g_75_25, "div.first")},
|
328
|
+
#{nest(!g_25_75, !unit)}
|
329
|
+
*width: 73.5%
|
330
|
+
_width: 65.5%
|
331
|
+
|
332
|
+
#{!g_50_50},
|
333
|
+
#{!g_33_33_33},
|
334
|
+
#{!g_67_33},
|
335
|
+
#{!g_33_67},
|
336
|
+
#{!g_75_25},
|
337
|
+
#{!g_25_75}
|
338
|
+
+clearfix
|
339
|
+
|
340
|
+
#{nest(!g_33_33_33, !unit)}
|
341
|
+
float: left
|
@@ -0,0 +1,94 @@
|
|
1
|
+
module Compass
|
2
|
+
module Commands
|
3
|
+
class Base
|
4
|
+
attr_accessor :working_directory, :options
|
5
|
+
def initialize(working_directory, options)
|
6
|
+
self.working_directory = working_directory
|
7
|
+
self.options = options
|
8
|
+
end
|
9
|
+
|
10
|
+
def perform
|
11
|
+
raise StandardError.new("Not Implemented")
|
12
|
+
end
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
def projectize(path)
|
17
|
+
File.join(project_directory, separate(path))
|
18
|
+
end
|
19
|
+
# create a directory and all the directories necessary to reach it.
|
20
|
+
def directory(subdir, options = nil)
|
21
|
+
options ||= self.options
|
22
|
+
dir = subdir ? projectize(subdir) : project_directory
|
23
|
+
if File.exists?(dir) && File.directory?(dir) && options[:force]
|
24
|
+
print_action :exists, basename(dir) + File::SEPARATOR
|
25
|
+
elsif File.exists?(dir) && File.directory?(dir)
|
26
|
+
msg = "Directory #{basename(dir)} already exists. Run with --force to force project creation."
|
27
|
+
raise ::Compass::Exec::ExecError.new(msg)
|
28
|
+
elsif File.exists?(dir)
|
29
|
+
msg = "#{basename(dir)} already exists and is not a directory."
|
30
|
+
raise ::Compass::Exec::ExecError.new(msg)
|
31
|
+
else
|
32
|
+
print_action :directory, basename(dir) + File::SEPARATOR
|
33
|
+
FileUtils.mkdir_p(dir) unless options[:dry_run]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# copy/process a template in the compass template directory to the project directory.
|
38
|
+
def template(from, to, options)
|
39
|
+
to = projectize(to)
|
40
|
+
from = File.join(templates_directory, separate(from))
|
41
|
+
if File.exists?(to) && !options[:force]
|
42
|
+
#TODO: Detect differences & provide an overwrite prompt
|
43
|
+
msg = "#{basename(to)} already exists."
|
44
|
+
raise ::Compass::Exec::ExecError.new(msg)
|
45
|
+
elsif File.exists?(to)
|
46
|
+
print_action :remove, basename(to)
|
47
|
+
FileUtils.rm to unless options[:dry_run]
|
48
|
+
end
|
49
|
+
print_action :create, basename(to)
|
50
|
+
FileUtils.cp from, to unless options[:dry_run]
|
51
|
+
end
|
52
|
+
|
53
|
+
def write_file(file_name, contents)
|
54
|
+
if File.exists?(file_name) && !options[:force]
|
55
|
+
msg = "File #{basename(file_name)} already exists. Run with --force to force creation."
|
56
|
+
raise ::Compass::Exec::ExecError.new(msg)
|
57
|
+
end
|
58
|
+
if File.exists?(file_name)
|
59
|
+
print_action :overwrite, basename(file_name)
|
60
|
+
else
|
61
|
+
print_action :create, basename(file_name)
|
62
|
+
end
|
63
|
+
output = open(file_name,'w')
|
64
|
+
output.write(contents)
|
65
|
+
output.close
|
66
|
+
end
|
67
|
+
|
68
|
+
# returns the path to the templates directory and caches it
|
69
|
+
def templates_directory
|
70
|
+
@templates_directory ||= File.expand_path(File.join(File.dirname(__FILE__), separate("../../../frameworks/#{options[:framework]}/templates")))
|
71
|
+
end
|
72
|
+
|
73
|
+
# Write paths like we're on unix and then fix it
|
74
|
+
def separate(path)
|
75
|
+
path.gsub(%r{/}, File::SEPARATOR)
|
76
|
+
end
|
77
|
+
|
78
|
+
def basename(file, extra = 0)
|
79
|
+
if file.length > (working_directory.length + extra)
|
80
|
+
file[(working_directory.length + extra + 1)..-1]
|
81
|
+
else
|
82
|
+
File.basename(file)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
ACTIONS = [:directory, :exists, :remove, :create, :overwrite]
|
87
|
+
MAX_ACTION_LENGTH = ACTIONS.inject(0){|memo, a| [memo, a.to_s.length].max}
|
88
|
+
def print_action(action, extra)
|
89
|
+
puts "#{' ' * (MAX_ACTION_LENGTH - action.to_s.length)}#{action} #{extra}" if !options[:quiet] || options[:dry_run]
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require File.join(File.dirname(__FILE__), 'base')
|
3
|
+
require File.join(File.dirname(__FILE__), 'update_project')
|
4
|
+
|
5
|
+
module Compass
|
6
|
+
module Commands
|
7
|
+
class CreateProject < Base
|
8
|
+
|
9
|
+
attr_accessor :project_directory, :project_name
|
10
|
+
|
11
|
+
def initialize(working_directory, options)
|
12
|
+
super(working_directory, options)
|
13
|
+
self.project_name = options[:project_name]
|
14
|
+
self.project_directory = File.expand_path File.join(working_directory, project_name)
|
15
|
+
end
|
16
|
+
|
17
|
+
# all commands must implement perform
|
18
|
+
def perform
|
19
|
+
directory nil, options
|
20
|
+
src_dir = options[:src_dir] || "src"
|
21
|
+
css_dir = options[:css_dir] || "stylesheets"
|
22
|
+
directory src_dir, options.merge(:force => true)
|
23
|
+
directory css_dir, options.merge(:force => true)
|
24
|
+
template 'project/screen.sass', "#{src_dir}/screen.sass", options
|
25
|
+
template 'project/print.sass', "#{src_dir}/print.sass", options
|
26
|
+
template 'project/ie.sass', "#{src_dir}/ie.sass", options
|
27
|
+
UpdateProject.new(working_directory, options).perform
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'base')
|
2
|
+
|
3
|
+
module Compass
|
4
|
+
module Commands
|
5
|
+
class InstallRails < Base
|
6
|
+
def initialize(working_directory, options)
|
7
|
+
super(working_directory, options)
|
8
|
+
end
|
9
|
+
def perform
|
10
|
+
set_install_location
|
11
|
+
set_output_location
|
12
|
+
directory options[:stylesheets_location]
|
13
|
+
template 'project/screen.sass', "#{options[:stylesheets_location]}/screen.sass", options
|
14
|
+
template 'project/print.sass', "#{options[:stylesheets_location]}/print.sass", options
|
15
|
+
template 'project/ie.sass', "#{options[:stylesheets_location]}/ie.sass", options
|
16
|
+
write_file projectize('config/initializers/compass.rb'), initializer_contents
|
17
|
+
if has_application_layout?
|
18
|
+
next_steps
|
19
|
+
else
|
20
|
+
write_file projectize('app/views/layouts/application.html.haml'), application_layout_contents
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def initializer
|
25
|
+
init_file =
|
26
|
+
if File.exists?(init_file) && !options[:force]
|
27
|
+
msg = "File #{basename(init_file)} already exists. Run with --force to force project creation."
|
28
|
+
raise ::Compass::Exec::ExecError.new(msg)
|
29
|
+
end
|
30
|
+
if File.exists?(init_file)
|
31
|
+
print_action :overwrite, basename(init_file)
|
32
|
+
else
|
33
|
+
print_action :create, basename(init_file)
|
34
|
+
end
|
35
|
+
output = open(init_file,'w')
|
36
|
+
output.write(initializer_contents)
|
37
|
+
output.close
|
38
|
+
end
|
39
|
+
|
40
|
+
def initializer_contents
|
41
|
+
%Q{require 'compass'
|
42
|
+
# If you have any compass plugins, require them here.
|
43
|
+
Sass::Plugin.options[:template_location] = {
|
44
|
+
"\#{RAILS_ROOT}#{File::SEPARATOR}#{options[:stylesheets_location]}" => "\#{RAILS_ROOT}#{File::SEPARATOR}#{options[:css_location]}"
|
45
|
+
}
|
46
|
+
Compass::Frameworks::ALL.each do |framework|
|
47
|
+
Sass::Plugin.options[:template_location][framework.stylesheets_directory] = "\#{RAILS_ROOT}#{File::SEPARATOR}#{options[:css_location]}"
|
48
|
+
end
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
def application_layout_contents
|
53
|
+
%Q{!!! XML
|
54
|
+
!!!
|
55
|
+
%html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"}
|
56
|
+
%head
|
57
|
+
%meta{'http-equiv' => "content-type", :content => "text/html;charset=UTF-8"}
|
58
|
+
%title= @browser_title || 'Default Browser Title'
|
59
|
+
= stylesheet_link_tag '#{stylesheet_prefix}screen.css', :media => 'screen, projection'
|
60
|
+
= stylesheet_link_tag '#{stylesheet_prefix}print.css', :media => 'print'
|
61
|
+
/[if IE]
|
62
|
+
= stylesheet_link_tag '#{stylesheet_prefix}ie.css', :media => 'screen, projection'
|
63
|
+
%body
|
64
|
+
%h1 Welcome to Compass
|
65
|
+
= yield
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
def next_steps
|
70
|
+
puts <<NEXTSTEPS
|
71
|
+
|
72
|
+
Congratulations! Your project has been configured to use Compass.
|
73
|
+
Next add these lines to the head of your application.html.haml:
|
74
|
+
|
75
|
+
%head
|
76
|
+
= stylesheet_link_tag '#{stylesheet_prefix}screen.css', :media => 'screen, projection'
|
77
|
+
= stylesheet_link_tag '#{stylesheet_prefix}print.css', :media => 'print'
|
78
|
+
/[if IE]
|
79
|
+
= stylesheet_link_tag '#{stylesheet_prefix}ie.css', :media => 'screen, projection'
|
80
|
+
|
81
|
+
(you are using haml, aren't you?)
|
82
|
+
NEXTSTEPS
|
83
|
+
end
|
84
|
+
|
85
|
+
def has_application_layout?
|
86
|
+
File.exists?(projectize('app/views/layouts/application.rhtml')) ||
|
87
|
+
File.exists?(projectize('app/views/layouts/application.html.erb')) ||
|
88
|
+
File.exists?(projectize('app/views/layouts/application.html.haml'))
|
89
|
+
end
|
90
|
+
|
91
|
+
def stylesheet_prefix
|
92
|
+
if options[:css_location].length >= 19
|
93
|
+
"#{options[:css_location][19..-1]}/"
|
94
|
+
else
|
95
|
+
nil
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def project_directory
|
100
|
+
working_directory
|
101
|
+
end
|
102
|
+
|
103
|
+
def set_install_location
|
104
|
+
print "Compass recommends that you keep your stylesheets in app/stylesheets/ instead of the Sass default location of public/stylesheets/sass/.\nIs this OK? (Y/n) "
|
105
|
+
answer = gets
|
106
|
+
self.options[:stylesheets_location] = separate(answer.downcase[0] == ?n ? 'public/stylesheets/sass' : 'app/stylesheets')
|
107
|
+
end
|
108
|
+
def set_output_location
|
109
|
+
print "\nCompass recommends that you keep your compiled css in public/stylesheets/compiled/ instead the Sass default of public/stylesheets/.\nHowever, if you're exclusively using Sass, then public/stylesheets/ is recommended.\nEmit compiled stylesheets to public/stylesheets/compiled? (Y/n) "
|
110
|
+
answer = gets
|
111
|
+
self.options[:css_location] = separate(answer.downcase[0] == ?n ? 'public/stylesheets' : 'public/stylesheets/compiled')
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Compass
|
2
|
+
module Commands
|
3
|
+
class PrintVersion
|
4
|
+
attr_accessor :options
|
5
|
+
def initialize(working_directory, options)
|
6
|
+
self.options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def perform
|
10
|
+
if options[:quiet]
|
11
|
+
# The quiet option may make scripting easier
|
12
|
+
puts ::Compass.version[:string]
|
13
|
+
else
|
14
|
+
lines = []
|
15
|
+
lines << "Compass #{::Compass.version[:string]}"
|
16
|
+
lines << "Copyright (c) 2008 Chris Eppstein"
|
17
|
+
lines << "Released under the MIT License."
|
18
|
+
puts lines.join("\n")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|