stylesheet.go 441 B

12345678910111213141516171819202122232425
  1. package css
  2. // Stylesheet represents a parsed stylesheet
  3. type Stylesheet struct {
  4. Rules []*Rule
  5. }
  6. // NewStylesheet instanciate a new Stylesheet
  7. func NewStylesheet() *Stylesheet {
  8. return &Stylesheet{}
  9. }
  10. // Returns string representation of the Stylesheet
  11. func (sheet *Stylesheet) String() string {
  12. result := ""
  13. for _, rule := range sheet.Rules {
  14. if result != "" {
  15. result += "\n"
  16. }
  17. result += rule.String()
  18. }
  19. return result
  20. }