This repository was archived by the owner on Nov 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +34
-3
lines changed
Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ let css = Stylesheet {
3636 }
3737}
3838
39- print (StylesheetRenderer ().render (css))
39+ print (StylesheetRenderer (minify : false , indent : 4 ).render (css))
4040```
4141
4242## Credits & references
Original file line number Diff line number Diff line change @@ -10,6 +10,39 @@ import XCTest
1010
1111final class SwiftCssTests : XCTestCase {
1212
13+ func testMinifiedStylesheet( ) {
14+ let css = Stylesheet {
15+ Charset ( " UTF-8 " )
16+ Media {
17+ Root {
18+ Margin ( horizontal: . px( 8.5 ) , vertical: . px( 8 ) )
19+ Padding ( horizontal: . px( 8 ) , vertical: . px( 8 ) )
20+ }
21+ }
22+ }
23+ XCTAssertEqual ( StylesheetRenderer ( minify: true , indent: 2 ) . render ( css) , #"@charset "UTF-8";:root{margin:8.5px 8px;padding:8px 8px}"# )
24+ }
25+
26+ func testCustomIndentStylesheet( ) {
27+ let css = Stylesheet {
28+ Charset ( " UTF-8 " )
29+ Media {
30+ Root {
31+ Margin ( horizontal: . px( 8.5 ) , vertical: . px( 8 ) )
32+ Padding ( horizontal: . px( 8 ) , vertical: . px( 8 ) )
33+ }
34+ }
35+ }
36+ print ( StylesheetRenderer ( indent: 2 ) . render ( css) )
37+ XCTAssertEqual ( StylesheetRenderer ( indent: 2 ) . render ( css) , #"""
38+ @charset "UTF-8";
39+ :root {
40+ margin: 8.5px 8px;
41+ padding: 8px 8px;
42+ }
43+ """# )
44+ }
45+
1346 func testStylesheet( ) {
1447 let css = Stylesheet {
1548 Charset ( " UTF-8 " )
@@ -62,8 +95,6 @@ final class SwiftCssTests: XCTestCase {
6295 """# )
6396 }
6497
65-
66-
6798 func testVariable( ) {
6899 let css = Stylesheet {
69100 Media {
You can’t perform that action at this time.
0 commit comments