compass-respond 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,93 @@
1
+ sass-respond
2
+ ===============
3
+
4
+ There are two parts to this...
5
+
6
+ + +respond-to($device)
7
+
8
+ + +respond-above($screen-size)
9
+
10
+ +respond-to example
11
+ -------------------
12
+
13
+ SASS:
14
+
15
+ @import "respond-to"
16
+ .content
17
+ width: 100%
18
+ margin-right: auto
19
+ margin-left: auto
20
+ +respond-to(handhelds)
21
+ .content-title
22
+ display: none
23
+ +respond-to(wide-handhelds)
24
+ width: 90%
25
+ +respond-to(tablets)
26
+ width: 80%
27
+ +respond-to(desktops)
28
+ width: 70%
29
+ max-width: 1150px
30
+
31
+ CSS:
32
+
33
+ .content { width: 100%; margin-right: auto; margin-left: auto; }
34
+ @media only screen and (max-width: 479px) { .content .content-title { display: none; } }
35
+ @media only screen and (min-width: 480px) and (max-width: 767px) { .content { width: 90%; } }
36
+ @media only screen and (min-width: 768px) and (max-width: 959px) { .content { width: 80%; } }
37
+ @media only screen and (min-width: 960px) { .content { width: 70%; max-width: 1150px; } }
38
+
39
+ +respond-above example
40
+ ----------------------
41
+
42
+ SASS:
43
+
44
+ @import "respond-above"
45
+ .charts
46
+ column-count: 1
47
+ +respond-above(xs)
48
+ column-count: 2
49
+ +respond-above(s)
50
+ column-count: 3
51
+ +respond-above(m)
52
+ column-count: 4
53
+ +respond-above(l)
54
+ column-count: 5
55
+ +respond-above(xl)
56
+ column-count: 6
57
+
58
+ CSS:
59
+
60
+ .charts { column-count: 1; }
61
+ @media only screen and (min-width: 480px) { .charts { column-count: 2; } }
62
+ @media only screen and (min-width: 600px) { .charts { column-count: 3; } }
63
+ @media only screen and (min-width: 768px) { .charts { column-count: 4; } }
64
+ @media only screen and (min-width: 992px) { .charts { column-count: 5; } }
65
+ @media only screen and (min-width: 1382px) { .charts { column-count: 6; } }
66
+
67
+
68
+ Usage
69
+ ------
70
+
71
+ First add compass-respond to your Gemfile:
72
+
73
+ gem "compass-respond"
74
+
75
+ And require compass-respond-to in your compass.rb or config.rb:
76
+
77
+ require "compass-respond"
78
+
79
+ Then you can import the mixin you want into your .sass file:
80
+
81
+ @import "respond-to"
82
+ @import "respond-above"
83
+
84
+ Credit
85
+ ------
86
+
87
+ respond-to() is a convenience plugin for [Chris Eppstein's Gist](https://gist.github.com/1215856#file_7_media_queries.sass) demonstrating Sass 3.2's block passing to mixins.
88
+
89
+ respond-above() is a simple mixin based on Malarkey's [320andup](https://github.com/malarkey/320andup/) responsive steps.
90
+
91
+ I'm fully expecting Compass to add something like this in the near future.
92
+
93
+ Many thanks to Brandon Mathis and his [Fancy Buttons](https://github.com/imathis/fancy-buttons), which I used as a template for this gem.
@@ -0,0 +1,2 @@
1
+ require 'rubygems'
2
+ require 'rake'
@@ -0,0 +1,6 @@
1
+ ---
2
+ :major: 0
3
+ :minor: 0
4
+ :patch: 1
5
+ :state:
6
+ :build:
@@ -0,0 +1,2 @@
1
+ require "compass"
2
+ Compass::Frameworks.register("compass-respond", :path => File.join(File.dirname(__FILE__)))
@@ -0,0 +1,24 @@
1
+ // https://github.com/malarkey/320andup/
2
+
3
+ $respond-above-xs: 480px !default
4
+ $respond-above-s: 600px !default
5
+ $respond-above-m: 768px !default
6
+ $respond-above-l: 992px !default
7
+ $respond-above-xl: 1382px !default
8
+
9
+ =respond-above($screen-size)
10
+ @if $screen-size == xs
11
+ @media only screen and (min-width: $respond-above-xs)
12
+ @content
13
+ @else if $screen-size == s
14
+ @media only screen and (min-width: $respond-above-s)
15
+ @content
16
+ @else if $screen-size == m
17
+ @media only screen and (min-width: $respond-above-m)
18
+ @content
19
+ @else if $screen-size == l
20
+ @media only screen and (min-width: $respond-above-l)
21
+ @content
22
+ @else if $screen-size == xl
23
+ @media only screen and (min-width: $respond-above-xl)
24
+ @content
@@ -0,0 +1,25 @@
1
+ // https://gist.github.com/1215856#file_7_media_queries.sass
2
+
3
+ $respond-to-handhelds-max: 479px !default
4
+
5
+ $respond-to-wide-handhelds-min: ($respond-to-handhelds-max + 1px) !default
6
+ $respond-to-wide-handhelds-max: 767px !default
7
+
8
+ $respond-to-tablets-min: ($respond-to-wide-handhelds-max + 1) !default
9
+ $respond-to-tablets-max: 959px !default
10
+
11
+ $respond-to-desktops-min: ($respond-to-tablets-max + 1) !default
12
+
13
+ =respond-to($device)
14
+ @if $device == handhelds
15
+ @media only screen and (max-width: $respond-to-handhelds-max)
16
+ @content
17
+ @else if $device == wide-handhelds
18
+ @media only screen and (min-width: $respond-to-wide-handhelds-min) and (max-width: $respond-to-wide-handhelds-max)
19
+ @content
20
+ @else if $device == tablets
21
+ @media only screen and (min-width: $respond-to-tablets-min) and (max-width: $respond-to-tablets-max)
22
+ @content
23
+ @else if $device == desktops
24
+ @media only screen and (min-width: $respond-to-desktops-min)
25
+ @content
@@ -0,0 +1,60 @@
1
+ module RespondTo
2
+ module Version
3
+ # Returns a hash representing the version.
4
+ # The :major, :minor, and :teeny keys have their respective numbers.
5
+ # The :string key contains a human-readable string representation of the version.
6
+ # The :rev key will have the current revision hash.
7
+ #
8
+ # This method swiped from Fancy Buttons by Brandon Mathis who swiped it from Compass by Chris Eppstein who swiped it from Haml and then modified it, so some credit goes to Nathan Weizenbaum too.
9
+ def version
10
+ if defined?(@version)
11
+ @version
12
+ else
13
+ read_version
14
+ end
15
+ end
16
+
17
+ protected
18
+
19
+ def scope(file) # :nodoc:
20
+ File.join(File.dirname(__FILE__), '..', file)
21
+ end
22
+
23
+ def read_version
24
+ require 'yaml'
25
+ @version = YAML::load(File.read(scope('VERSION.yml')))
26
+ @version[:teeny] = @version[:patch]
27
+ @version[:string] = "#{@version[:major]}.#{@version[:minor]}"
28
+ @version[:string] << ".#{@version[:patch]}" if @version[:patch]
29
+ @version[:string] << ".#{@version[:state]}" if @version[:state]
30
+ @version[:string] << ".#{@version[:build]}" if @version[:build]
31
+ #if !ENV['OFFICIAL'] && r = revision
32
+ # @version[:string] << ".#{r[0..6]}"
33
+ #end
34
+ @version
35
+ end
36
+
37
+ def revision
38
+ revision_from_git
39
+ end
40
+
41
+ def revision_from_git
42
+ if File.exists?(scope('.git/HEAD'))
43
+ rev = File.read(scope('.git/HEAD')).strip
44
+ if rev =~ /^ref: (.*)$/
45
+ rev = File.read(scope(".git/#{$1}")).strip
46
+ end
47
+ end
48
+ end
49
+ end
50
+ extend RespondTo::Version
51
+ def self.const_missing(const)
52
+ # This avoid reading from disk unless the VERSION is requested.
53
+ if const == :VERSION
54
+ version[:string]
55
+ else
56
+ super
57
+ end
58
+ end
59
+ end
60
+
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: compass-respond
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mike Stenhouse
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-18 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sass
16
+ requirement: &70335765962920 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.0.alpha
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70335765962920
25
+ - !ruby/object:Gem::Dependency
26
+ name: compass
27
+ requirement: &70335765960700 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 0.11.7
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70335765960700
36
+ description: Easier media queries for Compass.
37
+ email: mike@donotremove.co.uk
38
+ executables: []
39
+ extensions: []
40
+ extra_rdoc_files: []
41
+ files:
42
+ - README.md
43
+ - VERSION.yml
44
+ - Rakefile
45
+ - lib/compass-respond.rb
46
+ - lib/stylesheets/_respond-above.sass
47
+ - lib/stylesheets/_respond-to.sass
48
+ - lib/version.rb
49
+ homepage: http://github.com/mikesten/compass-respond
50
+ licenses: []
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 1.8.10
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: Easier media queries for Compass.
73
+ test_files: []