cssm

package module
v0.0.0-...-d589e1b Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 11 Imported by: 3

README

cssm

Scoped CSS for gomponents.

Documentation

Overview

Package cssm provides scoped CSS for gomponents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Process

func Process(styles string) ([]byte, map[string]string, error)

Parses the CSS and returns the CSS processed, the key-value pair of the classes and scoped classes.

Types

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

Collector allows for using one or more rulesets, scoping them deterministically, caching those results, and provides helpers to access the scoped classnames. This is not safe for concurrent access.

func (*Collector) C

func (c *Collector) C(rules string, className ...string) gomponents.Node

C returns a gomponents.Node that serves as the class attribute for all the provided class names.

func (*Collector) Classes

func (c *Collector) Classes(rules string) (map[string]string, error)

Classes returns the classes mapped to their corresponding scoped names.

func (*Collector) R

func (c *Collector) R(rules string) gomponents.Node

R returns a gomponents.Node that serves as the class attribute for the special "root" class name.

func (*Collector) Render

func (c *Collector) Render(w io.Writer) error

Render the collected styles.

Jump to

Keyboard shortcuts

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