cssformat

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2026 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterRulesBySelector

func FilterRulesBySelector(css, selectorPattern string) string

FilterRulesBySelector filters CSS rules to those whose selector matches the pattern. The pattern is matched case-insensitively against the selector text. Supports simple substring matching and basic patterns.

func Format

func Format(input string) (string, error)

Format formats CSS with proper indentation for readability. Uses 2-space indentation and adds line breaks between rules.

func FormatComputedStyles

func FormatComputedStyles(styles map[string]string) string

FormatComputedStyles formats computed styles as CSS properties. Input: map of property names to values Output: formatted CSS properties (one per line)

func FormatComputedStylesMulti

func FormatComputedStylesMulti(stylesList []map[string]string) string

FormatComputedStylesMulti formats multiple computed styles with -- separators. Input: slice of maps (one per element) Output: formatted CSS properties with -- separators between elements

Types

type CSSRule

type CSSRule struct {
	Selector string
	Body     string
}

CSSRule represents a parsed CSS rule with selector and body.

func ParseRules

func ParseRules(css string) []CSSRule

ParseRules extracts CSS rules from CSS text. Returns a slice of CSSRule with selector and body.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL