Documentation
¶
Index ¶
- type Definition
- type Node
- type Sprite
- func (s *Sprite) AddFile(id, svgFile string) error
- func (s *Sprite) AddRaw(id, content, viewBox string)
- func (s *Sprite) Append() model.Fielder
- func (s *Sprite) At(i int) model.Fielder
- func (s *Sprite) DecodeFields(r model.FieldReader)
- func (s *Sprite) EncodeFields(w model.FieldWriter)
- func (s *Sprite) IsNil() bool
- func (s *Sprite) Len() int
- func (s *Sprite) MarshalJSON() ([]byte, error)
- func (s *Sprite) Merge(other *Sprite) *Sprite
- func (s *Sprite) Pointers() []any
- func (s *Sprite) Schema() []model.Field
- func (s *Sprite) String() string
- func (s *Sprite) UnmarshalJSON(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
Definition holds the data needed to build a <symbol>.
type Sprite ¶
type Sprite struct {
// contains filtered or unexported fields
}
Sprite holds SVG icon definitions for server-side sprite sheet injection.
func NewSprite ¶
func NewSprite(icons ...Definition) *Sprite
NewSprite constructs a *Sprite from typed icons.
func (*Sprite) AddFile ¶ added in v0.1.3
AddFile adds a whole .svg file (as read from disk) to the sprite as a <symbol>. The viewBox is taken from the file's root <svg> element, and only its inner markup becomes the symbol body — keeping the root tag would nest an <svg> inside the <symbol>, which is not valid sprite markup.
A file with no viewBox is rejected: nothing can recover the coordinate system the drawing was authored in, and defaulting to one clips or misaligns it.
func (*Sprite) AddRaw ¶
AddRaw adds a raw symbol to the sprite. Used for assetmin's raw .svg file/favicon path.
func (*Sprite) DecodeFields ¶
func (s *Sprite) DecodeFields(r model.FieldReader)
func (*Sprite) EncodeFields ¶
func (s *Sprite) EncodeFields(w model.FieldWriter)