Skip to content

[feature request] add interface support to CSS class processor #1283

@derstruct

Description

@derstruct

It would be great to allow custom CSS class providers

Currently it supports multiple concrete types, including []CSSClass where CSSClass is an interface with ClassName() string func.

Probably the easiest way to go is to add CSSClass support itself here:

runtime.go: 122

func (cp *cssProcessor) Add(item any) {
	switch c := item.(type) {
	/* ... */
	case []CSSClass:
		for _, item := range c {
			cp.Add(item)
		}
	case func() CSSClass: 
		cp.AddClassName(c().ClassName(), true)
	case CSSClass: // <---------------------
		cp.AddClassName(c.ClassName(), true)
	default:
		cp.AddClassName(unknownTypeClassName, true)
	}
}

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions