support-for 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -39
- data/bower.json +24 -0
- data/eyeglass-exports.js +9 -0
- data/package.json +34 -0
- data/support-for.gemspec +4 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fb25d749273f86f93c672438bc9a61018ea5a5c
|
4
|
+
data.tar.gz: 3f7f84117b58bc3d09d0c6d929500113a5361763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2785e2596cb9f89678108fdd9f8a1a7b251b8b1b78091bef067f1033c933b641845a9be16387a6a528935e818561dcf42a2d849aceb050fdbe5997a1556505f8
|
7
|
+
data.tar.gz: d569daac8408da4ee2d0f21f2fd8953a77dde2e5199cc35c46b1d950ac62718682a4c1eda8987d723eef6181d5359e892c395058623ca9104a4ec01862c0b481
|
data/README.md
CHANGED
@@ -1,56 +1,59 @@
|
|
1
1
|
# support-for
|
2
2
|
|
3
|
-
The `support-for` module
|
3
|
+
The `support-for` module allows Sass authors to conditionally add support for specific browser versions to their Sass module or Sass partials.
|
4
4
|
|
5
|
-
|
5
|
+
[Autoprefixer](https://github.com/postcss/autoprefixer) is great for conditionally adding vendor prefixes, but sometimes you need more extensive CSS for specific versions of browsers. For example, adding px fallbacks to rem units when you need IE 8 support.
|
6
|
+
|
7
|
+
Authors of Sass code with support-for can specify which browser versions they want to support by setting a simple Sass variable, `$support-for`.
|
6
8
|
|
7
9
|
Here are some example usages:
|
8
10
|
|
9
11
|
1. The Sass author only wants to support Safari 8 and later (and no other browsers) because he is an asshole.
|
10
12
|
|
11
|
-
```scss
|
12
|
-
$support-for: (
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
);
|
13
|
+
```scss
|
14
|
+
$support-for: (
|
15
|
+
safari: 8,
|
16
|
+
'*': null, // null means "no support" and is the
|
17
|
+
// default value for any browser not
|
18
|
+
// specified in $support-for
|
19
|
+
);
|
18
20
|
|
19
|
-
// Normalize-scss uses support-for
|
20
|
-
|
21
|
-
|
21
|
+
// Normalize-scss uses support-for to conditionally
|
22
|
+
// output CSS for old and new browsers.
|
23
|
+
@import "normalize";
|
24
|
+
```
|
22
25
|
|
23
26
|
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
27
|
|
25
|
-
```scss
|
26
|
-
$support-for: (
|
27
|
-
|
28
|
-
|
29
|
-
);
|
28
|
+
```scss
|
29
|
+
$support-for: (
|
30
|
+
'*': -4,
|
31
|
+
ie: 6,
|
32
|
+
);
|
30
33
|
|
31
|
-
@import "normalize";
|
32
|
-
```
|
34
|
+
@import "normalize";
|
35
|
+
```
|
33
36
|
|
34
37
|
3. The Sass author is working for a government client and every browser version has a specific version specified in the contract.
|
35
38
|
|
36
|
-
```scss
|
37
|
-
$support-for: (
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
);
|
45
|
-
|
46
|
-
@import "normalize";
|
47
|
-
```
|
39
|
+
```scss
|
40
|
+
$support-for: (
|
41
|
+
chrome: 29,
|
42
|
+
edge: 20,
|
43
|
+
firefox: 26,
|
44
|
+
ie: 8,
|
45
|
+
opera: 14,
|
46
|
+
safari: 5,
|
47
|
+
);
|
48
|
+
|
49
|
+
@import "normalize";
|
50
|
+
```
|
48
51
|
|
49
52
|
### Update your Sass partials to use `support-for()`
|
50
53
|
|
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
|
54
|
+
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 to see some of your options.
|
52
55
|
|
53
|
-
If, however, you want to conditionally include Sass in
|
56
|
+
If, however, you want to conditionally include Sass in the stylesheets you author, you can update your Sass code to wrap those lines of Sass with an `@if` block that uses the `support-for()` function.
|
54
57
|
|
55
58
|
```
|
56
59
|
@mixin my-sweet-sweet-mixin($cocoa: lots) {
|
@@ -78,13 +81,13 @@ quite easy to add it.
|
|
78
81
|
Alter your `my-module.gemspec` file:
|
79
82
|
|
80
83
|
1. Find the line for your module's Sass dependency. It should look similar to this:
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
+
```
|
85
|
+
spec.add_runtime_dependency('sass', '~> 3.3')
|
86
|
+
```
|
84
87
|
2. Just after that line, add this:
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
+
```
|
89
|
+
spec.add_runtime_dependency('support-for', '~> 1.0')
|
90
|
+
```
|
88
91
|
|
89
92
|
### NPM (and node-sass)
|
90
93
|
|
data/bower.json
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"name": "support-for",
|
3
|
+
"description": "Allows Sass authors to conditionally add support for specific browser versions.",
|
4
|
+
"main": "sass/_support-for.scss",
|
5
|
+
"authors": [
|
6
|
+
"John Albin Wilkins <virtually.johnalbin@gmail.com> (http://john.albin.net/)"
|
7
|
+
],
|
8
|
+
"license": "GPL-2.0",
|
9
|
+
"keywords": [
|
10
|
+
"sass",
|
11
|
+
"browser",
|
12
|
+
"support"
|
13
|
+
],
|
14
|
+
"homepage": "https://github.com/JohnAlbin/support-for",
|
15
|
+
"moduleType": [],
|
16
|
+
"ignore": [
|
17
|
+
"**/.*",
|
18
|
+
"lib",
|
19
|
+
"node_modules",
|
20
|
+
"sache.json",
|
21
|
+
"support-for.gemspec",
|
22
|
+
"test"
|
23
|
+
]
|
24
|
+
}
|
data/eyeglass-exports.js
ADDED
data/package.json
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
{
|
2
|
+
"name": "support-for",
|
3
|
+
"version": "1.0.1",
|
4
|
+
"description": "Allows Sass authors to conditionally add support for specific browser versions.",
|
5
|
+
"homepage": "https://github.com/JohnAlbin/support-for",
|
6
|
+
"bugs": {
|
7
|
+
"url": "https://github.com/JohnAlbin/support-for/issues"
|
8
|
+
},
|
9
|
+
"repository": {
|
10
|
+
"type": "git",
|
11
|
+
"url": "git://github.com/JohnAlbin/support-for.git"
|
12
|
+
},
|
13
|
+
"author": "John Albin Wilkins <virtually.johnalbin@gmail.com> (http://john.albin.net/)",
|
14
|
+
"keywords": [
|
15
|
+
"sass",
|
16
|
+
"browser",
|
17
|
+
"support"
|
18
|
+
],
|
19
|
+
"main": "sass/_support-for.scss",
|
20
|
+
"eyeglass": {
|
21
|
+
"exports": "eyeglass-exports.js"
|
22
|
+
},
|
23
|
+
"scripts": {
|
24
|
+
"test": "mocha",
|
25
|
+
"posttest": "eslint test"
|
26
|
+
},
|
27
|
+
"license": "GPL-2.0",
|
28
|
+
"devDependencies": {
|
29
|
+
"chai": "^3.4.1",
|
30
|
+
"eslint": "^1.9.0",
|
31
|
+
"mocha": "^2.3.4",
|
32
|
+
"sassy-test": "^2.0.0"
|
33
|
+
}
|
34
|
+
}
|
data/support-for.gemspec
CHANGED
@@ -9,7 +9,7 @@ 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.
|
12
|
+
spec.version = '1.0.1'
|
13
13
|
spec.date = '2015-11-17'
|
14
14
|
spec.licenses = ['GPL-2']
|
15
15
|
|
@@ -20,7 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.files = `git ls-files`.split($/).select {|f| File.exist?(f) && f =~ %r{^(lib|sass)/} }
|
22
22
|
spec.files += %w(
|
23
|
+
bower.json
|
24
|
+
eyeglass-exports.js
|
23
25
|
LICENSE.md
|
26
|
+
package.json
|
24
27
|
README.md
|
25
28
|
support-for.gemspec
|
26
29
|
)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: support-for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Albin Wilkins
|
@@ -32,7 +32,10 @@ extra_rdoc_files: []
|
|
32
32
|
files:
|
33
33
|
- LICENSE.md
|
34
34
|
- README.md
|
35
|
+
- bower.json
|
36
|
+
- eyeglass-exports.js
|
35
37
|
- lib/support-for.rb
|
38
|
+
- package.json
|
36
39
|
- sass/_support-for.scss
|
37
40
|
- support-for.gemspec
|
38
41
|
homepage: https://github.com/JohnAlbin/support-for
|
@@ -54,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
57
|
- !ruby/object:Gem::Version
|
55
58
|
version: '0'
|
56
59
|
requirements: []
|
57
|
-
rubyforge_project: 1.0.
|
60
|
+
rubyforge_project: 1.0.1
|
58
61
|
rubygems_version: 2.4.8
|
59
62
|
signing_key:
|
60
63
|
specification_version: 4
|