compass-respond-to 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,48 @@
1
+ sass-respond-to
2
+ ===============
3
+
4
+ Example
5
+ -------
6
+
7
+ .content
8
+ width: 100%
9
+ margin-right: auto
10
+ margin-left: auto
11
+ +respond-to(handhelds)
12
+ .content-title
13
+ display: none
14
+ +respond-to(wide-handhelds)
15
+ width: 90%
16
+ +respond-to(tablets)
17
+ width: 80%
18
+ +respond-to(desktops)
19
+ width: 70%
20
+ max-width: 1150px
21
+
22
+ Usage
23
+ ------
24
+
25
+ First add compass-respond-to to your Gemfile:
26
+
27
+ gem "compass-respond-to"
28
+
29
+ And require compass-respond-to in your compass.rb or config.rb:
30
+
31
+ require "compass-respond-to"
32
+
33
+ Then you can import it into your .sass files:
34
+
35
+ @import "respond-to"
36
+
37
+ Credit
38
+ ------
39
+
40
+ This is a convenience plugin for Chris Eppstein's Gist demonstrating Sass 3.2's block passing to mixins.
41
+
42
+ https://gist.github.com/1215856#file_7_media_queries.sass
43
+
44
+ I'm fully expecting Compass to add something like this in the near future.
45
+
46
+ Many thanks to Brandon Mathis and his Fancy Buttons, which I used as a template for this gem.
47
+
48
+ https://github.com/imathis/fancy-buttons
@@ -0,0 +1,2 @@
1
+ require 'rubygems'
2
+ require 'rake'
@@ -0,0 +1,6 @@
1
+ ---
2
+ :major: 0
3
+ :minor: 0
4
+ :patch: 3
5
+ :state:
6
+ :build:
@@ -0,0 +1,2 @@
1
+ require "compass"
2
+ Compass::Frameworks.register("compass-respond-to", :path => File.join(File.dirname(__FILE__)))
@@ -0,0 +1,23 @@
1
+ $respond-to-handhelds-max: 479px !default
2
+
3
+ $respond-to-wide-handhelds-min: ($respond-to-handhelds-max + 1px) !default
4
+ $respond-to-wide-handhelds-max: 767px !default
5
+
6
+ $respond-to-tablets-min: ($respond-to-wide-handhelds-max + 1) !default
7
+ $respond-to-tablets-max: 959px !default
8
+
9
+ $respond-to-desktops-min: ($respond-to-tablets-max + 1) !default
10
+
11
+ =respond-to($media)
12
+ @if $media == handhelds
13
+ @media only screen and (max-width: $respond-to-handhelds-max)
14
+ @content
15
+ @else if $media == wide-handhelds
16
+ @media only screen and (min-width: $respond-to-wide-handhelds-min) and (max-width: $respond-to-wide-handhelds-max)
17
+ @content
18
+ @else if $media == tablets
19
+ @media only screen and (min-width: $respond-to-tablets-min) and (max-width: $respond-to-tablets-max)
20
+ @content
21
+ @else if $media == desktops
22
+ @media only screen and (min-width: $respond-to-desktops-min)
23
+ @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,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: compass-respond-to
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mike Stenhouse
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-16 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sass
16
+ requirement: &70293336560060 !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: *70293336560060
25
+ - !ruby/object:Gem::Dependency
26
+ name: compass
27
+ requirement: &70293336559200 !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: *70293336559200
36
+ description: Easy media queries with chriseppstein's respond-to mixin.
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-to.rb
46
+ - lib/stylesheets/_respond-to.sass
47
+ - lib/version.rb
48
+ homepage: http://github.com/mikesten/compass-respond-to
49
+ licenses: []
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubyforge_project:
68
+ rubygems_version: 1.8.10
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: Easy media queries with chriseppstein's respond-to mixin.
72
+ test_files: []