diff --git a/lib/compress.js b/lib/compress.js index 601bd73..c1309f0 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -144,6 +144,17 @@ Compiler.prototype.page = function(node){ + this.emit('}'); }; +/** + * Visit font-face node. + */ + +Compiler.prototype['font-face'] = function(node){ + return this.emit('@font-face', node.position, true) + + this.emit('{') + + this.mapVisit(node.declarations) + + this.emit('}'); +}; + /** * Visit rule node. */ diff --git a/lib/identity.js b/lib/identity.js index cc9fd5c..f20c4b9 100644 --- a/lib/identity.js +++ b/lib/identity.js @@ -174,6 +174,19 @@ Compiler.prototype.page = function(node){ + this.emit('\n}'); }; +/** + * Visit font-face node. + */ + +Compiler.prototype['font-face'] = function(node){ + return this.emit('@font-face ', node.position, true) + + this.emit('{\n') + + this.emit(this.indent(1)) + + this.mapVisit(node.declarations, '\n') + + this.emit(this.indent(-1)) + + this.emit('\n}'); +}; + /** * Visit rule node. */ diff --git a/test/cases/font-face.compressed.css b/test/cases/font-face.compressed.css new file mode 100644 index 0000000..b08d099 --- /dev/null +++ b/test/cases/font-face.compressed.css @@ -0,0 +1 @@ +@font-face{font-family:"Bitstream Vera Serif Bold";src:url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");}body{font-family:"Bitstream Vera Serif Bold", serif;} diff --git a/test/cases/font-face.css b/test/cases/font-face.css new file mode 100644 index 0000000..09945e6 --- /dev/null +++ b/test/cases/font-face.css @@ -0,0 +1,8 @@ +@font-face { + font-family: "Bitstream Vera Serif Bold"; + src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf"); +} + +body { + font-family: "Bitstream Vera Serif Bold", serif; +}