Home / Function/ toStyleString() — astro Function Reference

toStyleString() — astro Function Reference

Architecture documentation for the toStyleString() function in util.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  30790445_2aea_3312_59dd_db6be23e86e9["toStyleString()"]
  05241a8b_1820_8286_5770_4da18477ecde["util.ts"]
  30790445_2aea_3312_59dd_db6be23e86e9 -->|defined in| 05241a8b_1820_8286_5770_4da18477ecde
  f16d0d52_160f_152d_f7fe_a1fd178b948b["addAttribute()"]
  f16d0d52_160f_152d_f7fe_a1fd178b948b -->|calls| 30790445_2aea_3312_59dd_db6be23e86e9
  96bbcc17_d278_1527_3d70_5a3cd1369c23["kebab()"]
  30790445_2aea_3312_59dd_db6be23e86e9 -->|calls| 96bbcc17_d278_1527_3d70_5a3cd1369c23
  style 30790445_2aea_3312_59dd_db6be23e86e9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/server/render/util.ts lines 32–39

export const toStyleString = (obj: Record<string, any>) =>
	Object.entries(obj)
		.filter(([_, v]) => (typeof v === 'string' && v.trim()) || typeof v === 'number')
		.map(([k, v]) => {
			if (k[0] !== '-' && k[1] !== '-') return `${kebab(k)}:${v}`;
			return `${k}:${v}`;
		})
		.join(';');

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does toStyleString() do?
toStyleString() is a function in the astro codebase, defined in packages/astro/src/runtime/server/render/util.ts.
Where is toStyleString() defined?
toStyleString() is defined in packages/astro/src/runtime/server/render/util.ts at line 32.
What does toStyleString() call?
toStyleString() calls 1 function(s): kebab.
What calls toStyleString()?
toStyleString() is called by 1 function(s): addAttribute.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free