support-for 1.0.0.beta.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29d7c18877ad7d383895ae9a8d25014bbff2e67e
4
- data.tar.gz: 36871ff68f8f2003467b7a6d06ff58f97d400f33
3
+ metadata.gz: a237da8b1487ba22400a55f5bf22ca8c70768b32
4
+ data.tar.gz: d4973a6ed4d70c5ad4d02be8d0003b10e472d02b
5
5
  SHA512:
6
- metadata.gz: 59bb4c779a38921ce12b7fa55a2d0963f8ea4c12d5ec6de1af181502a207f076bd9fdd8798874eab292b95fba818b04757b1955af91eb30facd35b99d37cd660
7
- data.tar.gz: f07b8cf5ff5316579b7be63ce34e8efc092049b584fc49d20ae162b69abc76b28fb702eb2477c99cc86c5dfecc699f81f30c3758ceb2d2806947bad13565bfd1
6
+ metadata.gz: 4da375a0b0a70a7b6331e67df9dd14cc78a49b23f8d28c7c641cef217b04e4f2195b21cdee5e548f750c3e5cf483e3e4c0f84faa2b06bbc8e5f42d8359777751
7
+ data.tar.gz: 7fee9548810ebbdba18cb127f37cd2b3d5c7dbe5172aeb0180f71aa065c0c9e66c82d190b4ab6bffbe03e6ff3ddc1ad27646bd71abc759a1a7c2e3c725fe0c8a
data/README.md CHANGED
@@ -1,8 +1,77 @@
1
1
  # support-for
2
2
 
3
- The `support-for` module is designed to be used by developers to ease conditional browser support while authoring their Sass module.
3
+ The `support-for` module is designed to be used by Sass authors to ease conditional browser support while creating their Sass module or Sass partial.
4
4
 
5
- ## Adding a support-for dependency to your module
5
+ Authors of Sass code that uses support-for can specify which browser versions they want to support by setting a simple Sass variable, `$support-for`.
6
+
7
+ Here are some example usages:
8
+
9
+ 1. The Sass author only wants to support Safari 8 and later (and no other browsers) because he is an asshole.
10
+
11
+ ```scss
12
+ $support-for: (
13
+ safari: 8,
14
+ '*': null, // null means "no support" and is the
15
+ // default value for any browser not
16
+ // specified in $support-for
17
+ );
18
+
19
+ // Normalize-scss uses support-for.
20
+ @import "normalize";
21
+ ```
22
+
23
+ 2. The Sass author wants to support the 4 most recent versions of all browsers which she can do by setting the wildcard browser, `'*'`. She also has to support IE 6 and later because the client hates her.
24
+
25
+ ```scss
26
+ $support-for: (
27
+ '*': -4,
28
+ ie: 6,
29
+ );
30
+
31
+ @import "normalize";
32
+ ```
33
+
34
+ 3. The Sass author is working for a government client and every browser version has a specific version specified in the contract.
35
+
36
+ ```scss
37
+ $support-for: (
38
+ chrome: 29,
39
+ edge: 20,
40
+ firefox: 26,
41
+ ie: 8,
42
+ opera: 14,
43
+ safari: 5,
44
+ );
45
+
46
+ @import "normalize";
47
+ ```
48
+
49
+ ### Update your Sass partials to use `support-for()`
50
+
51
+ If a Sass module tells you that it uses `support-for`, you just need to override the default value of the `$support-for` variable before you import that module. See the examples above about some of your options.
52
+
53
+ If, however, you want to conditionally include Sass in your CSS output, you can update your Sass code to wrap those lines of CSS with an `@if` block that uses the `support-for()` function.
54
+
55
+ ```
56
+ @mixin my-sweet-sweet-mixin($cocoa: lots) {
57
+ border-radius: 100%;
58
+
59
+ // Only include this property if we support IE 10.
60
+ @if support-for(ie, 10) {
61
+ // Remove border when applied to an `img` inside an `a` element in IE 8/9/10.
62
+ border: 0;
63
+ }
64
+ }
65
+ ```
66
+
67
+ If you later drop support for IE 10 (someday!), you just need to update the
68
+ `$support-for` variable and your code will stop outputting the IE-10-specific
69
+ CSS.
70
+
71
+ ## Updating your module to use `support-for`
72
+
73
+ If you are a Sass module author wanting to use `support-for` in your module, it's
74
+ quite easy to add it.
6
75
 
7
76
  ### Ruby Sass
8
77
 
@@ -30,3 +99,5 @@ Add your dependency with the following command:
30
99
  ```
31
100
  bower install --save support-for
32
101
  ```
102
+
103
+ [![Build Status](https://travis-ci.org/JohnAlbin/support-for.png?branch=master)](https://travis-ci.org/JohnAlbin/support-for)
@@ -1,14 +1,15 @@
1
1
  // Support the last 4 versions of all browsers except IE.
2
2
  $support-for: (
3
- chrome: 43,
4
- edge: 22,
5
- firefox: 39,
3
+ chrome: -4,
4
+ edge: -4,
5
+ firefox: -4,
6
6
  ie: 9,
7
- opera: 30,
8
- safari: 6,
7
+ opera: -4,
8
+ safari: -4,
9
+ '*': -4,
9
10
  ) !default;
10
11
 
11
- // Set the current version number for all browsers. As of: 2015-11-16
12
+ // Set the current version number for all browsers. As of: 2015-11-17
12
13
  $support-for-current-browser-version: (
13
14
  chrome: 46,
14
15
  edge: 25,
@@ -31,12 +32,17 @@ $support-for-current-browser-version: (
31
32
  @function support-for($browser, $version) {
32
33
  // Ensure $version is an integer (or null).
33
34
  @if not (type-of($version) == "null" or type-of($version) == "number" and round($version) == $version) {
34
- @error "The $version parameter of support-for() must be an integer; #{inspect($version)} given.";
35
+ @error "The $version parameter of support-for() must be an integer; #{type-of($version)} given.";
35
36
  }
36
37
 
37
38
  // Check against declared minimums.
38
- $min-version: if(map-has-key($support-for, $browser), map-get($support-for, $browser), null);
39
- // @TODO: Add '*' browser to provide default minimum version.
39
+ $min-version: null;
40
+ @if map-has-key($support-for, $browser) {
41
+ $min-version: map-get($support-for, $browser);
42
+ }
43
+ @else if map-has-key($support-for, '*') {
44
+ $min-version: map-get($support-for, '*');
45
+ }
40
46
 
41
47
  // Ensure $min-version is an integer (or null).
42
48
  @if type-of($min-version) != "null" and type-of($min-version) != "number" {
@@ -49,10 +55,10 @@ $support-for-current-browser-version: (
49
55
  // Negative $min-version means "X most recent versions".
50
56
  @if type-of($min-version) == "number" and $min-version < 0 {
51
57
  @if not map-has-key($support-for-current-browser-version, $browser) {
52
- @error "$support-for-current-browser-version: (#{$browser}: null) must be set to an integer.";
58
+ @error "#{$browser} not found in $support-for-current-browser-version map; it must be set to an integer.";
53
59
  }
54
60
  $min-version: map-get($support-for-current-browser-version, $browser) + $min-version + 1;
55
61
  }
56
62
 
57
- @return ($min-version and ($version >= $min-version));
63
+ @return if(($min-version and ($version >= $min-version)), true, false);
58
64
  }
data/support-for.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.homepage = 'https://github.com/JohnAlbin/support-for'
10
10
  spec.rubyforge_project =
11
11
 
12
- spec.version = '1.0.0.beta.1'
13
- spec.date = '2015-11-16'
12
+ spec.version = '1.0.0'
13
+ spec.date = '2015-11-17'
14
14
  spec.licenses = ['GPL-2']
15
15
 
16
16
  spec.authors = ['John Albin Wilkins']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: support-for
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Albin Wilkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-16 00:00:00.000000000 Z
11
+ date: 2015-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass
@@ -50,11 +50,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
50
50
  version: '0'
51
51
  required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ">"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 1.3.1
55
+ version: '0'
56
56
  requirements: []
57
- rubyforge_project: 1.0.0.beta.1
57
+ rubyforge_project: 1.0.0
58
58
  rubygems_version: 2.4.8
59
59
  signing_key:
60
60
  specification_version: 4