Styles

This page covers stylesheet resources in Doors.

If generic resource syntax is new, start with Resources. This page focuses on what is specific to <style> and <link rel="stylesheet">.

Start

Most pages start with one of these:

  • CSS written directly in the template: plain <style>...</style>
  • CSS kept in a file, bytes, or string: <link rel="stylesheet" href=(...)>
  • CSS already hosted somewhere: plain href="..."

Examples:

<style>
	h1 {
		color: red;
	}
</style>
<link
	rel="stylesheet"
	href=(doors.ResourceLocalFS("web/app.css"))>
<link rel="stylesheet" href="/assets/app.css">

Style Tags

Use plain <style>...</style> when the CSS belongs to one page or one component:

<style>
	h1 {
		color: red;
	}
</style>

By default, Doors does not keep that literal <style> tag. It collects the CSS, creates a stylesheet resource, and emits a stylesheet link in the final HTML.

Use raw when you want a literal browser <style> tag:

<style raw>
	h1 {
		color: red;
	}
</style>

name, private, and nocache also work here:

<style name="page.css" private>
	h1 {
		color: red;
	}
</style>

Attrs

These attrs control managed stylesheet behavior:

  • raw: keep the stylesheet tag or link raw
  • name: readable output file name
  • private: serve the stylesheet through an instance-scoped hook URL while still using the stylesheet pipeline
  • nocache: serve through an instance-scoped hook URL without shared resource caching

Example:

<link
	rel="stylesheet"
	href=(doors.ResourceBytes(appCSS))
	name="app.css"
	private>

Plain string URLs are passed through as-is. doors.ResourceExternal(...) keeps the browser URL direct while also adding that host to CSP. Handler and proxy sources already produce hook-backed URLs.

Use private when the stylesheet should not be publicly reachable.

Use nocache for dynamically generated styles that should not use shared resource caching.