Skip to content

Commit f38a30f

Browse files
author
Nicolas Gallagher
committed
Add support for @Custom-Media
Fix #34
1 parent e809b04 commit f38a30f

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
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
*/

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"devDependencies": {
1212
"mocha": "*",
1313
"should": "*",
14-
"css-parse": "1.6.0"
14+
"css-parse": "git://github.com/reworkcss/css-parse.git#7cef3658d0bba872cde05a85339034b187cb3397"
1515
},
1616
"main": "index",
1717
"repository": {

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)