Skip to content

Commit c5a1741

Browse files
committed
New stylesheet init
1 parent 3050dd4 commit c5a1741

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Sources/SwiftCss/Stylesheet/Stylesheet.swift

+4
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ public struct Stylesheet {
1111
public init(@RuleBuilder _ builder: () -> [Rule]) {
1212
self.rules = builder()
1313
}
14+
15+
public init(_ rules: [Rule]) {
16+
self.rules = rules
17+
}
1418
}

Tests/SwiftCssTests/SelectorTests.swift

+10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ final class SelectorTests: XCTestCase {
1212

1313
// MARK: - margin
1414

15+
func testRules() {
16+
let css = Stylesheet([
17+
Charset("UTF-8")
18+
])
19+
20+
XCTAssertEqual(StylesheetRenderer().render(css), #"""
21+
@charset "UTF-8";
22+
"""#)
23+
}
24+
1525
func testMarginBottom() {
1626
let css = Stylesheet {
1727
Media {

0 commit comments

Comments
 (0)