modernizr-mixin 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -12
- data/lib/modernizr-mixin.rb +2 -2
- data/stylesheets/_modernizr.scss +73 -70
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2826bb0962442c50c1ace1a520a0978c2ae0afc3
|
4
|
+
data.tar.gz: def3e9363494f188d3cd8f41a9a1367de56e62d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6873c4b0533efacf2f51ea111aa84540e4726d8bf11f42e76b610e5e11018d29de8582de933d427f706c2acb85e2cdb92595d00dae3a06020bd9edb9e2e1659f
|
7
|
+
data.tar.gz: b2ac07b634166d3c7d0be06d36bd1d429271700c15eba0ab967c4d6a815abe02af2f0e812de5489470356b8d8dab37417f7789ac9f04ace07112be77b3c51c01
|
data/README.md
CHANGED
@@ -2,32 +2,28 @@
|
|
2
2
|
|
3
3
|
A simple way for DRYier, faster and cleaner Modernizr tests in Sass.
|
4
4
|
|
5
|
+
[![Build Status](https://travis-ci.org/danielguillan/modernizr-mixin.svg?branch=master)](https://travis-ci.org/danielguillan/modernizr-mixin)
|
5
6
|
|
6
7
|
## Install
|
7
8
|
|
8
|
-
Requires Sass 3.
|
9
|
+
Requires Sass 3.4
|
9
10
|
|
10
11
|
There are 3 ways of installing the Modernizr mixin:
|
11
12
|
|
12
13
|
### Download
|
13
14
|
|
14
|
-
Download
|
15
|
+
Download [_modernizr.scss](/stylesheets/_modernizr.scss) and place it in your Sass directory.
|
15
16
|
|
16
17
|
### Bower
|
17
18
|
|
18
|
-
|
19
|
+
Run the following command:
|
19
20
|
|
20
21
|
bower install --save-dev modernizr-mixin
|
21
22
|
|
22
23
|
### Compass extension
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
gem install modernizr-mixin
|
27
|
-
|
28
|
-
Then add the following line to your `config.rb`:
|
29
|
-
|
30
|
-
require 'modernizr-mixin'
|
25
|
+
1. `gem install modernizr-mixin`
|
26
|
+
2. Add `require 'modernizr-mixin'` to your `config.rb`
|
31
27
|
|
32
28
|
## Usage
|
33
29
|
|
@@ -82,6 +78,6 @@ CSS output:
|
|
82
78
|
}
|
83
79
|
```
|
84
80
|
|
85
|
-
##
|
81
|
+
## Credits
|
86
82
|
|
87
|
-
Thanks
|
83
|
+
Thanks [Hugo Giraudel](https://github.com/hugogiraudel) for the code review and tweaks.
|
data/lib/modernizr-mixin.rb
CHANGED
data/stylesheets/_modernizr.scss
CHANGED
@@ -1,30 +1,23 @@
|
|
1
|
-
//
|
1
|
+
// -----------------------------------------------------------------------------
|
2
2
|
// Modernizr mixin
|
3
|
-
//
|
4
|
-
|
5
|
-
//
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
// =============================================================================
|
22
|
-
// 1. Modernizr mixin
|
23
|
-
// =============================================================================
|
24
|
-
|
25
|
-
@mixin modernizr($features, $supports) {
|
26
|
-
|
27
|
-
$everything-okay: true;
|
3
|
+
// -----------------------------------------------------------------------------
|
4
|
+
|
5
|
+
// -----------------------------------------------------------------------------
|
6
|
+
// Modernizr
|
7
|
+
// -----------------------------------------------------------------------------
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Prints classes for supported or unsupported features
|
11
|
+
* ---
|
12
|
+
* @access private
|
13
|
+
* ---
|
14
|
+
* @param {Bool} $supports - Whether to check for supported features or not
|
15
|
+
* @param {ArgList} $features - List of features
|
16
|
+
* ---
|
17
|
+
* @throws `$feature` is not a `string` for `modernizr`
|
18
|
+
*/
|
19
|
+
|
20
|
+
@mixin modernizr($supports, $features...) {
|
28
21
|
|
29
22
|
// Use the 'no-' prefix if checking for unsuported features (e.g. `.no-translate3d`)
|
30
23
|
$prefix: if($supports, '', 'no-');
|
@@ -32,28 +25,23 @@
|
|
32
25
|
// Features selector
|
33
26
|
// a) create a string if checking for supported features. We'll concatenate class names later on (e.g. `.translate3d.opacity selector`)
|
34
27
|
// b) create a list if checking for unsuported features. We'll append the class names later on (e.g. `.no-js selector, .no-translate3d selector`)
|
35
|
-
$selector: if($supports, '',
|
28
|
+
$selector: if($supports, '', unquote('.no-js'));
|
36
29
|
|
37
|
-
//
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
// 1.1 Generate placeholder and selectors
|
42
|
-
// =====================================
|
30
|
+
// Make sure the mixin has been called within a selector
|
31
|
+
@if not & {
|
32
|
+
@error 'Modernizr mixin should be called within a selector.';
|
33
|
+
}
|
43
34
|
|
35
|
+
// Generate placeholder and selectors
|
44
36
|
@each $feature in $features {
|
45
37
|
|
46
38
|
// Making sure $feature is a string
|
47
39
|
@if type-of($feature) != string {
|
48
40
|
|
49
|
-
$
|
50
|
-
@warn '`#{$feature} is not a string for `modernizr`';
|
41
|
+
@error '`#{$feature} is not a string for `modernizr`';
|
51
42
|
|
52
43
|
} @else {
|
53
44
|
|
54
|
-
// Add feature name to the placeholder string (e.g. '%yep' + '-' + 'translate3d' or '%nope' + '-' + 'translate3d')
|
55
|
-
$placeholder: $placeholder + '-' + $feature;
|
56
|
-
|
57
45
|
// Define the new selector string (e.g. `.translate3d` or `.no-translate3d`)
|
58
46
|
$new-selector: #{'.' + $prefix + $feature};
|
59
47
|
|
@@ -65,45 +53,60 @@
|
|
65
53
|
}
|
66
54
|
}
|
67
55
|
|
68
|
-
|
69
|
-
|
70
|
-
// 1.2 Define the placholder and print @content
|
71
|
-
// =====================================
|
72
|
-
|
73
|
-
#{$placeholder} & {
|
74
|
-
@content;
|
75
|
-
}
|
76
|
-
|
77
|
-
|
78
|
-
// 1.3 Define feature selector(s) and extend the placeholder
|
79
|
-
// =====================================
|
56
|
+
// Generate selector nesting features classes and the parent selector
|
57
|
+
$selector: selector-nest($selector, &);
|
80
58
|
|
59
|
+
// Define feature selector(s) and print @content
|
81
60
|
@at-root #{$selector} {
|
82
|
-
@
|
61
|
+
@content;
|
83
62
|
}
|
84
63
|
|
85
|
-
}
|
86
64
|
}
|
87
65
|
|
88
|
-
// =============================================================================
|
89
|
-
// 2. Aliases
|
90
|
-
// =============================================================================
|
91
66
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
67
|
+
// -----------------------------------------------------------------------------
|
68
|
+
// Yep mixin
|
69
|
+
// -----------------------------------------------------------------------------
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Prints classes for supported features
|
73
|
+
* ---
|
74
|
+
* @requires modernizr
|
75
|
+
* ---
|
76
|
+
* @access public
|
77
|
+
* ---
|
78
|
+
* @param {ArgList} $features - List of features
|
79
|
+
* ---
|
80
|
+
* @example scss
|
81
|
+
* .my-selector { @include yep(opacity, csstransforms) { // ... } }
|
82
|
+
*/
|
83
|
+
|
84
|
+
@mixin yep($features...) {
|
85
|
+
@include modernizr(true, $features...) {
|
86
|
+
@content;
|
99
87
|
}
|
88
|
+
}
|
100
89
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
90
|
+
// -----------------------------------------------------------------------------
|
91
|
+
// Nope mixin
|
92
|
+
// -----------------------------------------------------------------------------
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Nope “alias”
|
96
|
+
* Prints classes for unsupported features and lack of JS
|
97
|
+
* ---
|
98
|
+
* @requires modernizr
|
99
|
+
* ---
|
100
|
+
* @access public
|
101
|
+
* ---
|
102
|
+
* @param {ArgList} $features - List of features
|
103
|
+
* ---
|
104
|
+
* @example scss
|
105
|
+
* .my-selector { @include nope(opacity, csstransforms) { // ... } }
|
106
|
+
*/
|
107
|
+
|
108
|
+
@mixin nope($features...) {
|
109
|
+
@include modernizr(false, $features...) {
|
110
|
+
@content;
|
109
111
|
}
|
112
|
+
}
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modernizr-mixin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Guillan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '3.
|
26
|
+
version: '3.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: compass
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0.0
|
33
|
+
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.0.0
|
40
|
+
version: 1.0.0
|
41
41
|
description: A simple way for DRYier, faster and cleaner Modernizr tests in Sass.
|
42
42
|
email:
|
43
43
|
- daniel.guillan@gmail.com
|
@@ -58,17 +58,17 @@ require_paths:
|
|
58
58
|
- lib
|
59
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - '>='
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.3.6
|
69
69
|
requirements: []
|
70
70
|
rubyforge_project: modernizr-mixin
|
71
|
-
rubygems_version: 2.
|
71
|
+
rubygems_version: 2.0.14
|
72
72
|
signing_key:
|
73
73
|
specification_version: 4
|
74
74
|
summary: Simple and comprehensive mixin for Modernizr tests in Sass
|