semantic-mixins 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.md ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2012 Gustavo Guichard
2
+ ===
3
+
4
+ MIT License
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ semantic-mixins
2
+ ===============
3
+
4
+ A collection of mixins to make your Sass code look more semantic
@@ -0,0 +1,400 @@
1
+ // This code isn't yet fully tested
2
+
3
+ // CUSTOM HTML RESETS
4
+ html
5
+ text-rendering: optimizeLegibility
6
+ -webkit-font-smoothing: antialiased
7
+
8
+ = css-techniques($font-size: 16)
9
+
10
+ html
11
+ font-size: relative-size($font-size,16)
12
+
13
+ body
14
+ font-size: 1em
15
+ line-height: 1.4
16
+
17
+ hr
18
+ display: block
19
+ height: 1px
20
+ border: 0
21
+ border-top: 1px solid #ccc
22
+ margin: 1em 0
23
+ padding: 0
24
+
25
+ // Remove the gap between images and the bottom of their containers: h5bp.com/i/440
26
+ img
27
+ vertical-align: middle
28
+
29
+ // Remove default fieldset styles.
30
+ fieldset
31
+ border: 0
32
+ margin: 0
33
+ padding: 0
34
+
35
+ // Allow only vertical resizing of textareas.
36
+ textarea
37
+ resize: vertical
38
+
39
+ // USEFULL MIXINS
40
+
41
+ // This mixin is simple yet awesome to use, it'll give semantics to your sass code.
42
+ // Use it like so:
43
+ // ul.nav_menu
44
+ // padding: 20px
45
+ // +context(footer) // or +context("footer .menu_section") as a string when it's a class or id or a plural css selector.
46
+ // background: green
47
+ = context($selector)
48
+ #{$selector} &
49
+ @content
50
+
51
+ // IMAGE MIXINS
52
+ // Before using this mixin you should put the images in a folder called sprites
53
+ // and then import'em like so: @import "sprites/*.png"
54
+ = sprite-replace($name, $boilerplate: false)
55
+ +sprites-sprite($name)
56
+ @if $boilerplate
57
+ +boilerplate-image-replace
58
+ @else
59
+ +hide-text
60
+ display: block
61
+ width: sprites-sprite-width($name)
62
+ height: sprites-sprite-height($name)
63
+
64
+ = image-replace($img, $boilerplate: false)
65
+ @if $boilerplate
66
+ +boilerplate-image-replace
67
+ @else
68
+ +hide-text
69
+ display: block
70
+ background-repeat: no-repeat
71
+ height: image-height($img)
72
+ width: image-width($img)
73
+ background-image: image-url($img)
74
+
75
+ // Don't use this technique if you are stylizing an pseudo element (e.g. decorative-content)
76
+ = boilerplate-image-replace
77
+ background-color: transparent
78
+ border: 0
79
+ overflow: hidden
80
+ +decorative-content(before, false)
81
+ width: 0
82
+ height: 100%
83
+ // IE 6/7 fallback
84
+ +ie6-hack
85
+ text-indent: -9999px
86
+
87
+ = inline-icon($img, $gap:5px, $pos: left, $padding: 0)
88
+ background-image: image-url($img)
89
+ background-repeat: no-repeat
90
+ @if $pos == right
91
+ background-position: right top
92
+ text-align: right
93
+ @else
94
+ background-position: left top
95
+ text-align: left
96
+ line-height: image-height($img)
97
+ padding: $padding
98
+ padding-#{$pos}: image-width($img) + $gap
99
+
100
+
101
+ // TEXT MIXIS
102
+ // Use it to set the color, background and text-shadow of selected areas of page
103
+ = selection($no-shadow: true)
104
+ ::selection
105
+ @if $no-shadow
106
+ text-shadow: none
107
+ @content
108
+ ::-moz-selection
109
+ @if $no-shadow
110
+ text-shadow: none
111
+ @content
112
+
113
+ // Set a color for the inputs placeholders. Compass doesn't have it =P
114
+ = placeholder-color($color)
115
+ &::-webkit-input-placeholder
116
+ color: $color
117
+ &:-moz-placeholder
118
+ color: $color
119
+ &:-ms-input-placeholder
120
+ color: $color
121
+ &:input-placeholder
122
+ color: $color
123
+
124
+ @function relative-size($size,$context)
125
+ @return #{$size/$context}em
126
+
127
+ = justify($characters-after: 1, $characters-before: 2)
128
+ hyphens: auto
129
+ text-align: justify
130
+ overflow-wrap: hyphenate
131
+ -webkit-hyphens: auto
132
+ -webkit-hyphenate-character: "\2010"
133
+ -webkit-hyphenate-limit-after: $characters-after
134
+ -webkit-hyphenate-limit-before: $characters-before
135
+ -moz-hyphens: auto
136
+
137
+ // POSITIONING MIXINS
138
+ // Call this mixin to place a decorative content around an element, e.g a tape holding a post it.
139
+ // When using the default configurations, you just need to set the dimensions, position and a background
140
+ = decorative-content($position: after, $absolute: true)
141
+ @if $absolute
142
+ position: relative
143
+
144
+ &:#{$position}
145
+ content: ""
146
+ display: block
147
+ @if $absolute
148
+ position: absolute
149
+ @content
150
+
151
+
152
+ = absolute-centering($width: 0, $direction: left, $offset: 0)
153
+ #{$direction}: 50%
154
+ margin-#{$direction}: - ($width / 2) - $offset
155
+
156
+ = move($distance, $direction: bottom)
157
+ position: relative
158
+ #{$direction}: - $distance
159
+
160
+
161
+ // COLOR MIXINS
162
+ // Use this mixin instead of default compass +background-image mixin.
163
+ // Use the first argument is the same as you use in the compass mixin
164
+ // The second and third arguments are colors (probably the colors that you use at the end and start of tha gradient),
165
+ // then compass is gonna mix the colors and support the old f***ing browsers.
166
+ // If you use just one color it'll be the solid color
167
+ = legacy-background-image($options, $color1, $color2: false)
168
+ @if $color2
169
+ background-color: mix($color1, $color2)
170
+ @else
171
+ background-color: $color1
172
+ +background-image($options)
173
+
174
+ = vertical-gradient($color1, $color2, $legacy-mix-color: true)
175
+ @if $legacy-mix-color
176
+ +legacy-background-image(linear-gradient(top bottom, $color1, $color2), $color1, $color2)
177
+ @else
178
+ +legacy-background-image(linear-gradient(top bottom, $color1, $color2), $color1)
179
+
180
+ = horizontal-gradient($color1, $color2, $legacy-mix-color: true)
181
+ @if $legacy-mix-color
182
+ +legacy-background-image(linear-gradient(left right, $color1, $color2), $color1, $color2)
183
+ @else
184
+ +legacy-background-image(linear-gradient(left right, $color1, $color2), $color1)
185
+
186
+ = rgba($property, $color, $alpha: 1)
187
+ #{$property}: $color
188
+ #{$property}: rgba($color, $alpha)
189
+
190
+ // Accessibility
191
+ = for-blind-people($can-focus: true)
192
+ border: 0
193
+ clip: rect(0 0 0 0)
194
+ height: 1px
195
+ margin: -1px
196
+ overflow: hidden
197
+ padding: 0
198
+ position: absolute
199
+ width: 1px
200
+ @if $can-focus
201
+ &:active, &:focus
202
+ clip: auto
203
+ height: auto
204
+ margin: 0
205
+ overflow: visible
206
+ position: static
207
+ width: auto
208
+
209
+ // IE Hacks MIXINS
210
+ = ie6
211
+ +context(".ie6")
212
+ @content
213
+
214
+ = ie6-hack
215
+ +context("* html")
216
+ @content
217
+
218
+ = ie7
219
+ +context(".ie7")
220
+ @content
221
+
222
+ = ie7-hack
223
+ +context("*+html")
224
+ @content
225
+
226
+ = ie8
227
+ +context(".ie8")
228
+ @content
229
+
230
+ = legacy-inline-block
231
+ display: inline-block
232
+ *display: inline
233
+ +has-layout
234
+
235
+ = has-layout
236
+ zoom: 1
237
+
238
+
239
+ // ANIMATION
240
+ = keyframes($animation-name)
241
+ @-webkit-keyframes #{$animation-name}
242
+ @content
243
+ @-moz-keyframes #{$animation-name}
244
+ @content
245
+ @-o-keyframes #{$animation-name}
246
+ @content
247
+ @keyframes #{$animation-name}
248
+ @content
249
+
250
+ // MEDIA QUERIES MIXINS
251
+ // For the following mixins you can pass ipad, iphone, desktop, desktop-large, ipad-portrait, ipad-landscape,
252
+ // iphone-portrait, iphone-landscape or retina-display as arguments to the $device variable.
253
+
254
+ // Screen size variables
255
+ $iphone-portrait: 320px
256
+ $iphone-landscape: 480px
257
+ $ipad-portrait: 768px
258
+ $ipad-landscape: 980px
259
+ $desktop: 1224px
260
+ $desktop-large: 1824px
261
+
262
+ // Hides the element only in the device you choose
263
+ = hide-on($device)
264
+ +respond-to($device)
265
+ display: none
266
+
267
+ = hide-below($device)
268
+ +apply-to(less-than, $device)
269
+ display: none
270
+
271
+ = hide-above($device)
272
+ +apply-to(more-than, $device)
273
+ display: none
274
+
275
+ // Shows the element only in the device you choose
276
+ = show-on($device)
277
+ +apply-to(not-on, $device)
278
+ display: none
279
+
280
+
281
+ // The mixins below were inspired from here: https://gist.github.com/3931614 and a bit modified
282
+ // Specific device targeting
283
+ // Use: Only use if you want the style to respond to one device
284
+ // Example:
285
+ // +respond_to(ipad-landscape)
286
+ // will apply CSS only to an iPad at landscape rotation
287
+ = respond-to($device)
288
+
289
+ @if $device == retina-display
290
+ @media only screen and (-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-device-pixel-ratio: 1.5)
291
+ @content
292
+
293
+ @if $device == iphone
294
+ @media only screen and (min-width: $iphone-portrait) and (max-width: $iphone-landscape)
295
+ @content
296
+
297
+ @if $device == iphone-landscape
298
+ @media only screen and (min-width: $iphone-portrait) and (max-width: $iphone-landscape) and (orientation: landscape)
299
+ @content
300
+
301
+ @if $device == iphone-portrait
302
+ @media only screen and (max-width: $iphone-portrait) and (max-width: $iphone-landscape) and (orientation: portrait)
303
+ @content
304
+
305
+ @if $device == ipad
306
+ @media only screen and (min-width: $ipad-portrait) and (max-width: $ipad-landscape)
307
+ @content
308
+
309
+ @if $device == ipad-landscape
310
+ @media only screen and (min-width: $ipad-portrait) and (max-width: $ipad-landscape) and (orientation: landscape)
311
+ @content
312
+
313
+ @if $device == ipad-portrait
314
+ @media only screen and (max-width: $ipad-portrait) and (max-width: $ipad-landscape) and (orientation: portrait)
315
+ @content
316
+
317
+ @if $device == desktop
318
+ @media only screen and (min-width: $desktop) and (max-width: $desktop-large)
319
+ @content
320
+
321
+ @if $device == desktop-large
322
+ @media only screen and (min-width: $desktop-large)
323
+ @content
324
+
325
+ // General device targeting
326
+ // Use: Only use if you want the style to apply to many devices
327
+ // Example:
328
+ // +apply-to(smaller-than, iphone-portrait)
329
+ // will apply CSS to anything smaller than an iphone-portrait
330
+ // Example 2:
331
+ // +apply-to(not-on, retina-display)
332
+ // will apply CSS to anything but retina-display devices
333
+ = apply-to($filter, $device)
334
+
335
+ $extrema: null
336
+ @if $filter == less-than
337
+ $extrema: max
338
+ @if $filter == more-than
339
+ $extrema: min
340
+
341
+ @if $filter != not-on
342
+ @if $device == iphone-landscape
343
+ @media only screen and (#{$extrema}-width: $iphone-landscape)
344
+ @content
345
+
346
+ @if $device == iphone-portrait
347
+ @media only screen and (#{$extrema}-width: $iphone-portrait)
348
+ @content
349
+
350
+ @if $device == ipad-landscape
351
+ @media only screen and (#{$extrema}-width: $ipad-landscape)
352
+ @content
353
+
354
+ @if $device == ipad-portrait
355
+ @media only screen and (#{$extrema}-width: $ipad-portrait)
356
+ @content
357
+
358
+ @if $device == desktop
359
+ @media only screen and (#{$extrema}-width: $desktop)
360
+ @content
361
+
362
+ @if $device == desktop-large
363
+ @media only screen and (#{$extrema}-width: $desktop-large)
364
+ @content
365
+ @else
366
+ @if $device == retina-display
367
+ @media only screen and (-webkit-max-device-pixel-ratio: 1.1), (max--moz-device-pixel-ratio: 1.1), (-o-max-device-pixel-ratio: 1.1), (max-device-pixel-ratio: 1.1)
368
+ @content
369
+
370
+ @if $device == iphone
371
+ @media only screen and (max-width: $iphone-portrait - 1), (min-width: $iphone-landscape + 1)
372
+ @content
373
+
374
+ @if $device == iphone-landscape
375
+ @media only screen and (max-width: $iphone-landscape - 1), (min-width: $iphone-landscape + 1)
376
+ @content
377
+
378
+ @if $device == iphone-portrait
379
+ @media only screen and (max-width: $iphone-portrait - 1), (min-width: $iphone-portrait + 1)
380
+ @content
381
+
382
+ @if $device == ipad
383
+ @media only screen and (max-width: $ipad-portrait - 1), (min-width: $ipad-landscape + 1)
384
+ @content
385
+
386
+ @if $device == ipad-landscape
387
+ @media only screen and (max-width: $ipad-landscape - 1), (min-width: $ipad-landscape + 1)
388
+ @content
389
+
390
+ @if $device == ipad-portrait
391
+ @media only screen and (max-width: $ipad-portrait - 1), (min-width: $ipad-portrait + 1)
392
+ @content
393
+
394
+ @if $device == desktop
395
+ @media only screen and (max-width: $desktop - 1) and (min-width: $desktop-large)
396
+ @content
397
+
398
+ @if $device == desktop-large
399
+ @media only screen and (max-width: $desktop-large - 1)
400
+ @content
@@ -0,0 +1 @@
1
+ @import ./semantic-mixins/main
@@ -0,0 +1,4 @@
1
+ module SemanticMixins
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,17 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{semantic-mixins}
3
+ s.version = "0.1.0"
4
+
5
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5")
6
+ s.authors = ["Gustavo Guichard", "Josemar David Luedke", "Rafael Barboza"]
7
+ s.description = %q{A collection of mixins to make your Sass code look more semantic}
8
+ s.email = %w{gustavoguichard@gmail.com, josemarluedke@gmail.com, barboza.cardoso@gmail.com}
9
+ s.summary = %q{Some semantic mixins to enhance the compass plugin}
10
+ s.homepage = "https://github.com/gustavoguichard/semantic-mixins"
11
+ s.files = `git ls-files`.split($/)
12
+ s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
14
+ s.require_paths = ["lib"]
15
+ s.add_dependency('rails', '~> 3.1')
16
+ s.add_dependency('compass-rails')
17
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: semantic-mixins
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Gustavo Guichard
9
+ - Josemar David Luedke
10
+ - Rafael Barboza
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2012-11-14 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rails
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: '3.1'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: '3.1'
32
+ - !ruby/object:Gem::Dependency
33
+ name: compass-rails
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ description: A collection of mixins to make your Sass code look more semantic
49
+ email:
50
+ - gustavoguichard@gmail.com,
51
+ - josemarluedke@gmail.com,
52
+ - barboza.cardoso@gmail.com
53
+ executables: []
54
+ extensions: []
55
+ extra_rdoc_files: []
56
+ files:
57
+ - LICENSE.md
58
+ - README.md
59
+ - lib/assets/stylesheets/semantic-mixins.sass
60
+ - lib/assets/stylesheets/semantic-mixins/_main.sass
61
+ - lib/semantic-mixins.rb
62
+ - semantic-mixins.gemspec
63
+ homepage: https://github.com/gustavoguichard/semantic-mixins
64
+ licenses: []
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: 1.3.5
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 1.8.24
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Some semantic mixins to enhance the compass plugin
87
+ test_files: []