compass-retina 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in compass-retina.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Corey Woodcox
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Compass::Retina
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'compass-retina'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install compass-retina
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/compass-retina/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Corey Woodcox", "Josh Dean"]
6
+ gem.email = ["corey.woodcox@gmail.com", "github@designerdean.com"]
7
+ gem.description = %q{Compass plugin to insert retina background images if they exist}
8
+ gem.summary = %q{This awesome compass plugin inspired by Joe Lambert's mixin is awesome and inserts retina background images if they exist right alongside the regular ones and uses a media query to use the correct one.}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "compass-retina"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Compass::Retina::VERSION
17
+
18
+ gem.add_dependency "compass", "~>0.12.2"
19
+ end
@@ -0,0 +1,12 @@
1
+ require "compass"
2
+ require "compass-retina/version"
3
+ require "compass/sass_extensions/functions/retina_images"
4
+
5
+ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
6
+ Compass::Frameworks.register('compass-retina', :path => extension_path)
7
+
8
+ module Compass
9
+ module Retina
10
+ # Your code goes here...
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ module Compass
2
+ module Retina
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,17 @@
1
+ module Compass::SassExtensions::Functions::RetinaImages
2
+ def file_exists(filename)
3
+ filename = filename.value
4
+ filename = File.join (Compass.configuration.images_path ? Compass.configuration.images_path : Compass.configuration.project_path), filename
5
+ Sass::Script::Bool.new File.exists? filename
6
+ end
7
+
8
+ def retina_filename(filename)
9
+ filename = filename.value
10
+ extension = filename.chomp! File.extname(filename)
11
+ Sass::Script::String.new "#{filename}@2x#{extension}"
12
+ end
13
+ end
14
+
15
+ module Sass::Script::Functions
16
+ include Compass::SassExtensions::Functions::RetinaImages
17
+ end
@@ -0,0 +1,23 @@
1
+ @mixin background-image-retina($image) {
2
+ background-image: image-url($image);
3
+
4
+ // If we have a retina image then add styles for it too
5
+ @if file_exists(retina_filename($image)) {
6
+ @media only screen and (-webkit-min-device-pixel-ratio: 2) {
7
+ @include background-size(image-width($image) auto);
8
+ background-image: image-url(retina_filename($image));
9
+ }
10
+ }
11
+ }
12
+
13
+ @mixin inline-background-image-retina($image) {
14
+ background-image: inline-image($image);
15
+
16
+ // If we have a retina image then add styles for it too
17
+ @if file_exists(retina_filename($image)) {
18
+ @media only screen and (-webkit-min-device-pixel-ratio: 2) {
19
+ @include background-size(image-width($image) auto);
20
+ background-image: inline-image(retina_filename($image));
21
+ }
22
+ }
23
+ }
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: compass-retina
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Corey Woodcox
9
+ - Josh Dean
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-09-07 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: compass
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 0.12.2
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 0.12.2
31
+ description: Compass plugin to insert retina background images if they exist
32
+ email:
33
+ - corey.woodcox@gmail.com
34
+ - github@designerdean.com
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - .gitignore
40
+ - Gemfile
41
+ - LICENSE
42
+ - README.md
43
+ - Rakefile
44
+ - compass-retina.gemspec
45
+ - lib/compass-retina.rb
46
+ - lib/compass-retina/version.rb
47
+ - lib/compass/sass_extensions/functions/retina_images.rb
48
+ - stylesheets/_compass-retina.scss
49
+ homepage: ''
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.24
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: This awesome compass plugin inspired by Joe Lambert's mixin is awesome and
73
+ inserts retina background images if they exist right alongside the regular ones
74
+ and uses a media query to use the correct one.
75
+ test_files: []