Skip to content

Commit 8751db3

Browse files
author
Nicolas Gallagher
committed
Add support for @Custom-Media
Fix #34
1 parent d599337 commit 8751db3

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

lib/compress.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ Compiler.prototype.host = function(node){
166166
+ this.emit('}');
167167
};
168168

169+
/**
170+
* Visit custom-media node.
171+
*/
172+
173+
Compiler.prototype['custom-media'] = function(node){
174+
return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position);
175+
};
176+
169177
/**
170178
* Visit rule node.
171179
*/

lib/identity.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ Compiler.prototype.host = function(node){
202202
+ '\n}');
203203
};
204204

205+
/**
206+
* Visit custom-media node.
207+
*/
208+
209+
Compiler.prototype['custom-media'] = function(node){
210+
return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position);
211+
};
212+
205213
/**
206214
* Visit rule node.
207215
*/

test/cases/custom-media.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@custom-media --wide-window screen and (min-width: 40em);

0 commit comments

Comments
 (0)