@@ -7,6 +7,7 @@ use crate::rules::Location;
77use crate :: targets:: Browsers ;
88use crate :: vendor_prefix:: VendorPrefix ;
99use cssparser:: { serialize_identifier, serialize_name} ;
10+ #[ cfg( feature = "sourcemap" ) ]
1011use parcel_sourcemap:: { OriginalLocation , SourceMap } ;
1112
1213/// Options that control how CSS is serialized to a string.
@@ -15,6 +16,7 @@ pub struct PrinterOptions<'a> {
1516 /// Whether to minify the CSS, i.e. remove white space.
1617 pub minify : bool ,
1718 /// An optional reference to a source map to write mappings into.
19+ #[ cfg( feature = "sourcemap" ) ]
1820 pub source_map : Option < & ' a mut SourceMap > ,
1921 /// An optional project root path, used to generate relative paths for sources used in CSS module hashes.
2022 pub project_root : Option < & ' a str > ,
@@ -62,7 +64,9 @@ pub struct PseudoClasses<'a> {
6264pub struct Printer < ' a , ' b , ' c , W > {
6365 pub ( crate ) sources : Option < & ' c Vec < String > > ,
6466 dest : & ' a mut W ,
67+ #[ cfg( feature = "sourcemap" ) ]
6568 pub ( crate ) source_map : Option < & ' a mut SourceMap > ,
69+ #[ cfg( feature = "sourcemap" ) ]
6670 pub ( crate ) source_maps : Vec < Option < SourceMap > > ,
6771 pub ( crate ) loc : Location ,
6872 indent : u8 ,
@@ -86,7 +90,9 @@ impl<'a, 'b, 'c, W: std::fmt::Write + Sized> Printer<'a, 'b, 'c, W> {
8690 Printer {
8791 sources : None ,
8892 dest,
93+ #[ cfg( feature = "sourcemap" ) ]
8994 source_map : options. source_map ,
95+ #[ cfg( feature = "sourcemap" ) ]
9096 source_maps : Vec :: new ( ) ,
9197 loc : Location {
9298 source_index : 0 ,
@@ -209,6 +215,7 @@ impl<'a, 'b, 'c, W: std::fmt::Write + Sized> Printer<'a, 'b, 'c, W> {
209215 }
210216
211217 /// Adds a mapping to the source map, if any.
218+ #[ cfg( feature = "sourcemap" ) ]
212219 pub fn add_mapping ( & mut self , loc : Location ) {
213220 self . loc = loc;
214221
0 commit comments