A fast and lightweight CSS parser, written as a pure Swift package
MIT License
CiderCSSKit is lightweight CSS parser written as a pure Swift package. It was primarily designed to work with CiderKit, but the goal is to make it as agnostic as possible.
CiderCSSKit is still a work-in-progress. So many CSS features are not currenlty supported.
Here's the list of existing and missing features:
rgb
and rgba
>
, +
, and ~
) are not implemented::first-line
for example):nth-child()
for example)a[target]
or a[target="_blank"]
)The list of supported attributes is fairly limited for now but will expand over time.
background-color
border-image
and its sub-attributes
border-image-outset
border-image-repeat
border-image-slice
border-image-source
border-image-width
color
font
and its sub-attributes
font-family
font-size
font-stretch
font-style
font-variant
font-weight
line-height
padding
and its sub-attributes
padding-bottom
padding-left
padding-right
padding-top
text-align
transform-origin
vertical-align
visibility
z-index
Even if the ultimate goal is to support all syntax features, there is a long road ahead. Below is a list of short-term planned improvements:
hsl()
color function (#12)+
) (#6)>
) (#7)~
) (#8)The full documentation of the package is available here.
CiderCSSKit is available through Swift Package Manager.
To install it, simply add the dependency to your Package.swift
file:
dependencies: [
.package(url: "https://github.com/chsxf/CiderCSSKit.git", requirement: .branch("main")),
],
targets: [
.target(name: "YourTarget", dependencies: ["CiderCSSKit"]),
]
https://github.com/chsxf/CiderCSSKit.git
in the search field (top-right).main
in the associated text field.Unless stated otherwise, all source code and assets are distributed under the MIT License.