File tree 3 files changed +128
-2
lines changed
3 files changed +128
-2
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ module.exports = function(css, options){
189
189
function selector ( ) {
190
190
var m = match ( / ^ ( [ ^ { ] + ) / ) ;
191
191
if ( ! m ) return ;
192
- /* @fix Remove all comments from selectors
192
+ /* @fix Remove all comments from selectors
193
193
* http://ostermiller.org/findcomment.html */
194
194
return trim ( m [ 0 ] ) . replace ( / \/ \* ( [ ^ * ] | [ \r \n ] | ( \* + ( [ ^ * / ] | [ \r \n ] ) ) ) * \* \/ + / g, '' ) . split ( / \s * , \s * / ) ;
195
195
}
@@ -430,6 +430,33 @@ module.exports = function(css, options){
430
430
} ) ;
431
431
}
432
432
433
+ /**
434
+ * Parse font-face.
435
+ */
436
+
437
+ function atfontface ( ) {
438
+ var pos = position ( ) ;
439
+ var m = match ( / ^ @ f o n t - f a c e * / ) ;
440
+ if ( ! m ) return ;
441
+
442
+ if ( ! open ( ) ) return error ( "@font-face missing '{'" ) ;
443
+ var decls = comments ( ) ;
444
+
445
+ // declarations
446
+ var decl ;
447
+ while ( decl = declaration ( ) ) {
448
+ decls . push ( decl ) ;
449
+ decls = decls . concat ( comments ( ) ) ;
450
+ }
451
+
452
+ if ( ! close ( ) ) return error ( "@font-face missing '}'" ) ;
453
+
454
+ return pos ( {
455
+ type : 'font-face' ,
456
+ declarations : decls
457
+ } ) ;
458
+ }
459
+
433
460
/**
434
461
* Parse import
435
462
*/
@@ -480,7 +507,8 @@ module.exports = function(css, options){
480
507
|| atnamespace ( )
481
508
|| atdocument ( )
482
509
|| atpage ( )
483
- || athost ( ) ;
510
+ || athost ( )
511
+ || atfontface ( ) ;
484
512
}
485
513
486
514
/**
Original file line number Diff line number Diff line change
1
+ @font-face {
2
+ font-family : "Bitstream Vera Serif Bold" ;
3
+ src : url ("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf" );
4
+ }
5
+
6
+ body {
7
+ font-family : "Bitstream Vera Serif Bold" , serif;
8
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "type" : " stylesheet" ,
3
+ "stylesheet" : {
4
+ "rules" : [
5
+ {
6
+ "type" : " font-face" ,
7
+ "declarations" : [
8
+ {
9
+ "type" : " declaration" ,
10
+ "property" : " font-family" ,
11
+ "value" : " \" Bitstream Vera Serif Bold\" " ,
12
+ "position" : {
13
+ "start" : {
14
+ "line" : 2 ,
15
+ "column" : 3
16
+ },
17
+ "end" : {
18
+ "line" : 2 ,
19
+ "column" : 43
20
+ },
21
+ "source" : " font-face.css"
22
+ }
23
+ },
24
+ {
25
+ "type" : " declaration" ,
26
+ "property" : " src" ,
27
+ "value" : " url(\" http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf\" )" ,
28
+ "position" : {
29
+ "start" : {
30
+ "line" : 3 ,
31
+ "column" : 3
32
+ },
33
+ "end" : {
34
+ "line" : 3 ,
35
+ "column" : 78
36
+ },
37
+ "source" : " font-face.css"
38
+ }
39
+ }
40
+ ],
41
+ "position" : {
42
+ "start" : {
43
+ "line" : 1 ,
44
+ "column" : 1
45
+ },
46
+ "end" : {
47
+ "line" : 4 ,
48
+ "column" : 2
49
+ },
50
+ "source" : " font-face.css"
51
+ }
52
+ },
53
+ {
54
+ "type" : " rule" ,
55
+ "selectors" : [
56
+ " body"
57
+ ],
58
+ "declarations" : [
59
+ {
60
+ "type" : " declaration" ,
61
+ "property" : " font-family" ,
62
+ "value" : " \" Bitstream Vera Serif Bold\" , serif" ,
63
+ "position" : {
64
+ "start" : {
65
+ "line" : 7 ,
66
+ "column" : 3
67
+ },
68
+ "end" : {
69
+ "line" : 7 ,
70
+ "column" : 50
71
+ },
72
+ "source" : " font-face.css"
73
+ }
74
+ }
75
+ ],
76
+ "position" : {
77
+ "start" : {
78
+ "line" : 6 ,
79
+ "column" : 1
80
+ },
81
+ "end" : {
82
+ "line" : 8 ,
83
+ "column" : 2
84
+ },
85
+ "source" : " font-face.css"
86
+ }
87
+ }
88
+ ]
89
+ }
90
+ }
You can’t perform that action at this time.
0 commit comments