File tree 2 files changed +14
-11
lines changed
plugins/postcss-custom-media
2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -20,15 +20,18 @@ module.exports = customMedia
20
20
function customMedia ( options ) {
21
21
return function ( styles ) {
22
22
options = options || { }
23
- var extensions = options . extensions || { }
24
- Object . keys ( extensions ) . forEach ( function ( name ) {
25
- if ( name . slice ( 0 , 2 ) !== "--" ) {
26
- extensions [ "--" + name ] = extensions [ name ]
27
- delete extensions [ name ]
28
- }
29
- } )
30
- var append = options . append
31
- var preserve = append || options . preserve
23
+ var extensions = { }
24
+ if ( options . extensions ) {
25
+ Object . keys ( options . extensions ) . forEach ( function ( name ) {
26
+ var val = options . extensions [ name ]
27
+ if ( name . slice ( 0 , 2 ) !== "--" ) {
28
+ name = "--" + name
29
+ }
30
+ extensions [ name ] = val
31
+ } )
32
+ }
33
+ var appendExtensions = options . appendExtensions
34
+ var preserve = options . preserve
32
35
var map = { }
33
36
var toRemove = [ ]
34
37
@@ -69,7 +72,7 @@ function customMedia(options) {
69
72
} )
70
73
} )
71
74
72
- if ( append ) {
75
+ if ( appendExtensions ) {
73
76
var names = Object . keys ( map )
74
77
if ( names . length ) {
75
78
names . forEach ( function ( name ) {
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ test("@custom-media", function(t) {
45
45
extensions : {
46
46
"--viewport-max-s" : "(max-width: 30em)" ,
47
47
} ,
48
- append : true ,
48
+ appendExtensions : true ,
49
49
} )
50
50
51
51
t . end ( )
You can’t perform that action at this time.
0 commit comments