modernizr-mixin 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f946ac711102f5abe64c440ef41d7426b47db0a
4
- data.tar.gz: 79b99ea7dcbaed4911bd28bf01f29bdc232cd450
3
+ metadata.gz: 2826bb0962442c50c1ace1a520a0978c2ae0afc3
4
+ data.tar.gz: def3e9363494f188d3cd8f41a9a1367de56e62d4
5
5
  SHA512:
6
- metadata.gz: 42b0f6f4a19777e8f4e9fd721453e11475468a8d55d83028165c7368e50be0312456bb6d46a196eb2a1414b6f0a6d427d3e20491d490c7a2189910f5860cdf8a
7
- data.tar.gz: 5ffd4f797553dd00a99fb220918c9252feb33355142106bd7bd884f8a307c94a6871b9358d7e0695d484c2bafa6eeabea2cb1c0ddad5f53ae18106043e9f6852
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.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 `_modernizr.scss` which is located in the `stylesheets` folder and place it in your Sass directory.
15
+ Download [_modernizr.scss](/stylesheets/_modernizr.scss) and place it in your Sass directory.
15
16
 
16
17
  ### Bower
17
18
 
18
- To install the package using Bower simply run the following command:
19
+ Run the following command:
19
20
 
20
21
  bower install --save-dev modernizr-mixin
21
22
 
22
23
  ### Compass extension
23
24
 
24
- Modernizr is also available as a Compass extension:
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
- ## Acknowledgements
81
+ ## Credits
86
82
 
87
- Thanks to [Hugo Giraudel](https://github.com/hugogiraudel) for reviewing and tweaking the original code.
83
+ Thanks [Hugo Giraudel](https://github.com/hugogiraudel) for the code review and tweaks.
@@ -3,6 +3,6 @@ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
3
3
  Compass::Frameworks.register('modernizr-mixin', :path => extension_path)
4
4
 
5
5
  module ModernizrMixin
6
- VERSION = "2.0.0"
7
- DATE = "2014-05-06"
6
+ VERSION = "3.0.0"
7
+ DATE = "2014-08-31"
8
8
  end
@@ -1,30 +1,23 @@
1
- // =============================================================================
1
+ // -----------------------------------------------------------------------------
2
2
  // Modernizr mixin
3
- //
4
- // Table of contents:
5
- // 1. Modernizr mixin
6
- // 1.1 Generate placeholder name and selectors
7
- // 1.2 Define placeholder and print @content
8
- // 1.3 Define feature selector and extend the placeholder
9
- // 2. Aliases
10
- // 2.1 Yep alias
11
- // 2.2 Nope alias
12
- //
13
- // Usage:
14
- // .my-selector {
15
- // @include yep($features...) { ... }
16
- // @include nope($features...) { ... {
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, '', (unquote('.no-js')));
28
+ $selector: if($supports, '', unquote('.no-js'));
36
29
 
37
- // The placeholder (e.g. `%yep-translate3d` or `%nope-opacity`)
38
- $placeholder: if($supports, '%yep', '%nope');
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
- $everything-okay: false;
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
- @if $everything-okay == true {
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
- @extend #{$placeholder};
61
+ @content;
83
62
  }
84
63
 
85
- }
86
64
  }
87
65
 
88
- // =============================================================================
89
- // 2. Aliases
90
- // =============================================================================
91
66
 
92
- // 2.1 Yep alias
93
- // =====================================
94
-
95
- @mixin yep($features...) {
96
- @include modernizr($features, $supports: true) {
97
- @content;
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
- // 2.2 Nope alias
103
- // =====================================
104
-
105
- @mixin nope($features...) {
106
- @include modernizr($features, $supports: false) {
107
- @content;
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: 2.0.0
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-05-06 00:00:00.000000000 Z
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.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.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.alpha
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.alpha
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.2.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