dynamicstyler

package
v0.0.0-...-466d6df Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Props

type Props map[string]string

Props are a set of css properties, mapped name->prop props are not validated

type Styler

type Styler struct {
	ID  string
	Url string
	// contains filtered or unexported fields
}

Styler stores and serves styles classes are created dynamicaly with ULID

func New

func New() *Styler

New create new styler, sets its url Styler.Handler() can be used with any other url too

func (*Styler) Handler

func (st *Styler) Handler() http.HandlerFunc

Handler creates new http handler it recreates styles on every request no caching is done recommended to be used with Styler.ID or Styler.Url as path

func (*Styler) Props

func (st *Styler) Props(propsFunc func() Props) string

Props add style from props (map[string]string)

func (*Styler) Raw

func (st *Styler) Raw(cssFunc func() string) string

Raw adds styles as raw string

func (*Styler) WriteAll

func (st *Styler) WriteAll(w io.Writer) error

WriteAll writes styles to io.Writer in standard css format .classname { ...props... }

Jump to

Keyboard shortcuts

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