Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vanng822/css
Basic css parser in golang
https://github.com/vanng822/css
css go parser
Last synced: about 8 hours ago
JSON representation
Basic css parser in golang
- Host: GitHub
- URL: https://github.com/vanng822/css
- Owner: vanng822
- License: mit
- Created: 2015-02-22T12:20:27.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-05-07T21:07:13.000Z (6 months ago)
- Last Synced: 2024-06-18T15:40:39.657Z (5 months ago)
- Topics: css, go, parser
- Language: Go
- Homepage:
- Size: 55.7 KB
- Stars: 30
- Watchers: 6
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# css
Package css is for parsing css stylesheet.
# Document
[![GoDoc](https://godoc.org/github.com/vanng822/css?status.svg)](https://godoc.org/github.com/vanng822/css)
# example
import (
"github.com/vanng822/css"
"fmt"
)
func main() {
csstext := "td {width: 100px; height: 100px;}"
ss := css.Parse(csstext)
rules := ss.GetCSSRuleList()
for _, rule := range rules {
fmt.Println(rule.Style.Selector.Text())
fmt.Println(rule.Style.Styles)
}
}