breakpoint 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ # Changelog
2
+
3
+ ## 0.1 - May 22, 2012
4
+ * extract breakpoint from ssurvival kit to this gem
@@ -0,0 +1,153 @@
1
+ # Breakpoint #
2
+
3
+ **Really simple media queries in Sass**
4
+
5
+
6
+ ## Setup
7
+
8
+ ```sass
9
+ // create $breakpoint variables like so
10
+ // assume $breakpoint-default-feature if only a number
11
+ $breakpoint1: 500px
12
+ $breakpoint2: 30em
13
+ // set min-width/max-width if both values are numbers
14
+ $breakpoint3: 500px 700px
15
+ // if one value is a string, assume a feature/value pair
16
+ $breakpoint4: min-width 700px
17
+ $breakpoint5: max-width 700px
18
+ // for multidimensional lists, assume each item is a feature value pair
19
+ $breakpoint6: max-width 700px, orientation portrait
20
+ // handle one-sided features (ie. monochrome)
21
+ $breakpoint7: max-width 700px, orientation portrait, monochrome
22
+ $breakpoint8: monochrome
23
+ ```
24
+
25
+
26
+ ## Using Breakpoint
27
+
28
+ Call the mixin and pass one of your breakpoint variables. You can also call it with a la carte arguments.
29
+
30
+ ```sass
31
+ .foo
32
+ +breakpoint($breakpoint1)
33
+ content: 'foo'
34
+ .bar
35
+ +breakpoint($breakpoint2)
36
+ content: 'bar'
37
+ .baz
38
+ +breakpoint($breakpoint3)
39
+ content: 'baz'
40
+ .omg
41
+ +breakpoint($breakpoint4)
42
+ content: 'omg'
43
+ .wtf
44
+ +breakpoint($breakpoint5)
45
+ content: 'wtf'
46
+ .bbq
47
+ +breakpoint($breakpoint6)
48
+ content: 'bbq'
49
+ .zztop
50
+ +breakpoint($breakpoint7)
51
+ content: 'zztop'
52
+ .elp
53
+ +breakpoint($breakpoint1, print)
54
+ content: 'elp'
55
+ .csny
56
+ +breakpoint($breakpoint8)
57
+ content: 'csny'
58
+ .rhcp
59
+ +breakpoint(30em 40em)
60
+ content: 'rhcp'
61
+ ```
62
+
63
+ Example generated CSS
64
+
65
+ ```css
66
+ @media screen and (min-width: 500px) {
67
+ .foo {
68
+ content: "foo";
69
+ }
70
+ }
71
+
72
+ @media screen and (min-width: 30em) {
73
+ .bar {
74
+ content: "bar";
75
+ }
76
+ }
77
+
78
+ @media screen and (min-width: 500px) and (max-width: 700px) {
79
+ .baz {
80
+ content: "baz";
81
+ }
82
+ }
83
+
84
+ @media screen and (min-width: 700px) {
85
+ .omg {
86
+ content: "omg";
87
+ }
88
+ }
89
+
90
+ @media screen and (max-width: 700px) {
91
+ .wtf {
92
+ content: "wtf";
93
+ }
94
+ }
95
+
96
+ @media screen and (max-width: 700px) and (orientation: portrait) {
97
+ .bbq {
98
+ content: "bbq";
99
+ }
100
+ }
101
+
102
+ @media screen and (max-width: 700px) and (orientation: portrait) and (monochrome) {
103
+ .zztop {
104
+ content: "zztop";
105
+ }
106
+ }
107
+
108
+ @media print and (min-width: 500px) {
109
+ .elp {
110
+ content: "elp";
111
+ }
112
+ }
113
+
114
+ @media screen and (monochrome) {
115
+ .csny {
116
+ content: "csny";
117
+ }
118
+ }
119
+
120
+ @media screen and (min-width: 30em) and (max-width: 40em) {
121
+ .rhcp {
122
+ content: "rhcp";
123
+ }
124
+ }
125
+ ```
126
+
127
+ ### Installation
128
+
129
+ 0. [Install Sass and Compass](http://compass-style.org/install/), if you haven't already.
130
+ 1. **Terminal**: `gem install breakpoint`
131
+ 2. Add `require 'breakpoint'` in Compass's config.rb file
132
+
133
+
134
+
135
+
136
+ ## Requirements
137
+
138
+ - [Sass](http://sass-lang.com/)
139
+ - [Compass](http://compass-style.org/)
140
+
141
+
142
+
143
+
144
+ ## License
145
+
146
+ Licensed under MIT/GPL.
147
+
148
+ GPL license:
149
+ http://www.gnu.org/licenses/gpl.html
150
+
151
+ MIT license:
152
+ http://www.opensource.org/licenses/mit-license.php
153
+
@@ -0,0 +1,9 @@
1
+ require 'compass'
2
+ Compass::Frameworks.register("breakpoint", :path => "#{File.dirname(__FILE__)}/..")
3
+
4
+ module Breakpoint
5
+
6
+ VERSION = "0.1"
7
+ DATE = "2012-05-22"
8
+
9
+ end
@@ -0,0 +1,68 @@
1
+ // experimental - depends on Sass 3.2 or higher
2
+ define your own breakpoints
3
+ styles nested in the mixin will pass thru in @content
4
+ resist the urge to settle on common device sizes
5
+ http://marcdrummond.com/responsive-web-design/2011/12/29/default-breakpoints-are-dead
6
+
7
+
8
+ ////////////////////////////
9
+ // BREAKPOINT
10
+ // breakpoint($breakpoint, $media: 'screen')
11
+ //
12
+ // // create $breakpoint variables like so
13
+ // // assume $breakpoint-default-feature if only a number
14
+ // $breakpoint1: 500px
15
+ // $breakpoint2: 30em
16
+ // // set min-width/max-width if both values are numbers
17
+ // $breakpoint3: 500px 700px
18
+ // // if one value is a string, assume a feature/value pair
19
+ // $breakpoint4: min-width 700px
20
+ // $breakpoint5: max-width 700px
21
+ // // for multidimensional lists, assume each item is a feature/value pair
22
+ // $breakpoint6: max-width 700px, orientation portrait
23
+ // // handle one-sided features (ie. monochrome)
24
+ // $breakpoint7: max-width 700px, orientation portrait, monochrome
25
+ // $breakpoint8: monochrome
26
+ ////////////////////////////
27
+
28
+ $breakpoint-default-feature: min-width !default
29
+
30
+ @function breakpoint-concatenate($query-string, $new-value, $feature: $breakpoint-default-feature)
31
+ $new-string: ''
32
+ @if $feature != false
33
+ $new-string: #{$query-string}unquote("and (#{$feature}: #{$new-value}) ")
34
+ @else
35
+ $new-string: #{$query-string}unquote("and (#{$new-value}) ")
36
+ @return $new-string
37
+
38
+ =breakpoint($breakpoint, $media: 'screen')
39
+ // initialize string
40
+ $query-string: '#{$media} '
41
+ @if type-of($breakpoint) == number
42
+ // assume max-width if only a number
43
+ $query-string: breakpoint-concatenate($query-string, $breakpoint)
44
+ @if type-of($breakpoint) == string
45
+ // handle one-sided features (ie. monochrome)
46
+ $query-string: breakpoint-concatenate($query-string, $breakpoint, false)
47
+ @else if type-of($breakpoint) == list
48
+ @if (type-of(nth($breakpoint, 1)) == number) and (type-of(nth($breakpoint, 2)) == number)
49
+ // set min/max if both values are numbers
50
+ // @if $modular-scale-loaded == true
51
+ // $breakpoint: sort-list($breakpoint)
52
+ $query-string: breakpoint-concatenate($query-string, nth($breakpoint, 1), 'min-width')
53
+ $query-string: breakpoint-concatenate($query-string, nth($breakpoint, 2), 'max-width')
54
+ @else if (type-of(nth($breakpoint, 1)) == string)
55
+ // if one value is a string, assume a feature/value pair
56
+ $query-string: breakpoint-concatenate($query-string, nth($breakpoint, 2), nth($breakpoint, 1))
57
+ @else if (type-of(nth($breakpoint, 1)) == list)
58
+ // for multidimensional lists, assume each item is a feature value pair
59
+ @each $item in $breakpoint
60
+ @if type-of($item) == list
61
+ // $query-string: #{$query-string}unquote("and (#{nth($item, 1)}: #{nth($item, 2)}) ")
62
+ $query-string: breakpoint-concatenate($query-string, nth($item, 2), nth($item, 1))
63
+ @else
64
+ // handle one-sided features (ie. monochrome)
65
+ $query-string: breakpoint-concatenate($query-string, $item, false)
66
+ // write out the media query
67
+ @media #{$query-string}
68
+ @content
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: breakpoint
3
+ version: !ruby/object:Gem::Version
4
+ hash: 9
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ version: "0.1"
10
+ platform: ruby
11
+ authors:
12
+ - Mason Wendell
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-05-22 00:00:00 Z
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: compass
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 45
28
+ segments:
29
+ - 0
30
+ - 12
31
+ - 1
32
+ version: 0.12.1
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: Really simple media queries in Sass
36
+ email:
37
+ - mason@zivtech.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - README.markdown
46
+ - CHANGELOG.markdown
47
+ - lib/breakpoint.rb
48
+ - stylesheets/_breakpoint.sass
49
+ homepage: http://thecodingdesigner.com
50
+ licenses: []
51
+
52
+ post_install_message:
53
+ rdoc_options: []
54
+
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 3
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 23
72
+ segments:
73
+ - 1
74
+ - 3
75
+ - 6
76
+ version: 1.3.6
77
+ requirements: []
78
+
79
+ rubyforge_project:
80
+ rubygems_version: 1.8.17
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: An easy to use system for writing and managing media queries.
84
+ test_files: []
85
+