Key part is this wrapper:

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 output="raw" when you want a literal browser <style> tag:

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

Use output="minify" when the generated stylesheet should be minified:

<style output="minify">
	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:

  • output: default, minify, or 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. Handler and proxy sources already produce hook-backed URLs. private and nocache are most useful with managed stylesheet resources.

Choose

  • CSS written here for this page: plain <style>...</style>
  • CSS kept in a file, bytes, or string: <link rel="stylesheet" href=(...)>
  • Bytes already in memory: href=(appCSS) or href=(doors.ResourceBytes(appCSS))
  • Already-hosted stylesheet: plain string href
  • External stylesheet that should also be added to CSP: ResourceExternal(...)
  • Literal browser <style> tag: output="raw"
  • Minified managed stylesheet output: output="minify"
  • Shared public stylesheet URL is not wanted: use private or nocache