Documentation ¶
Overview ¶
Package css is for parsing css stylesheet.
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) } }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CSSRule ¶
type CSSRule struct { Type RuleType Style CSSStyleRule Rules []*CSSRule }
type CSSStyleDeclaration ¶
func NewCSSStyleDeclaration ¶
func NewCSSStyleDeclaration(property, value string, important bool) *CSSStyleDeclaration
func ParseBlock ¶
func ParseBlock(csstext string) []*CSSStyleDeclaration
ParseBlock take a string of a css block, parses it and returns a map of css style declarations.
func (*CSSStyleDeclaration) Text ¶
func (decl *CSSStyleDeclaration) Text() string
type CSSStyleRule ¶
type CSSStyleRule struct { Selector *CSSValue Styles []*CSSStyleDeclaration }
func (*CSSStyleRule) Text ¶
func (sr *CSSStyleRule) Text() string
type CSSStyleSheet ¶
func Parse ¶
func Parse(csstext string) *CSSStyleSheet
Parse takes a string of valid css rules, stylesheet, and parses it. Be aware this function has poor error handling so you should have valid syntax in your css
func (*CSSStyleSheet) GetCSSRuleList ¶
func (ss *CSSStyleSheet) GetCSSRuleList() []*CSSRule
type CSSValue ¶ added in v1.0.0
func NewCSSValue ¶ added in v1.0.0
func NewCSSValueString ¶ added in v1.0.0
func (*CSSValue) ParsedText ¶ added in v1.0.0
func (*CSSValue) SplitOnToken ¶ added in v1.0.0
Click to show internal directories.
Click to hide internal directories.