File tree 4 files changed +34
-0
lines changed
4 files changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ @page {
2
+ size : auto;
3
+ margin : 10%
4
+ }
5
+
6
+ @page foo, bar {
7
+ bar : baz
8
+ }
Original file line number Diff line number Diff line change
1
+
2
+ /**
3
+ * Module dependencies.
4
+ */
5
+
6
+ var parse = require ( 'css-parse' )
7
+ , stringify = require ( '..' )
8
+ , fs = require ( 'fs' )
9
+ , read = fs . readFileSync
10
+ , css = read ( 'examples/page.css' , 'utf8' ) ;
11
+
12
+ console . log ( stringify ( parse ( css ) , { compress : false } ) ) ;
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ Compiler.prototype.compile = function(node){
36
36
*/
37
37
38
38
Compiler . prototype . visit = function ( node ) {
39
+ if ( 'page' == node . type ) return this . page ( node ) ;
39
40
if ( node . document ) return this . document ( node ) ;
40
41
if ( node . comment ) return this . comment ( node ) ;
41
42
if ( node . charset ) return this . charset ( node ) ;
@@ -165,6 +166,19 @@ Compiler.prototype.keyframe = function(node){
165
166
+ '\n' + this . indent ( ) + '}\n' ;
166
167
} ;
167
168
169
+ /**
170
+ * Visit page node.
171
+ */
172
+
173
+ Compiler . prototype . page = function ( node ) {
174
+ return '@page ' + node . selectors . join ( ', ' )
175
+ + ' {\n'
176
+ + this . indent ( 1 )
177
+ + node . declarations . map ( this . declaration , this ) . join ( ';\n' )
178
+ + this . indent ( - 1 )
179
+ + '\n}' ;
180
+ } ;
181
+
168
182
/**
169
183
* Visit rule node.
170
184
*/
You can’t perform that action at this time.
0 commit comments