File Declarations
Every .csc file must declare exactly one role.
The declaration must be one of:
@page@layout Name(...)@component Name(...)@document
Page declaration
Pages must begin with @page.
@page
<h1>Hello</h1>
Only whitespace and blank lines may appear before @page.
This is enforced by the parser.
Layout declaration
Layouts use @layout followed by a PascalCase name.
@layout Main(title)
<main>
{{ slot }}
</main>
Layout props are optional:
@layout Main()
or:
@layout Main
Component declaration
Components use @component followed by a PascalCase name and parentheses.
@component Hero(title)
<section>
<h1>{{ title }}</h1>
</section>
The current parser requires parentheses for components, even when there are no props:
@component Card()
Document declaration
The global document uses:
@document
The document must contain an HTML document shell with <html>, <head>, and <body>.
Only one declaration
A file cannot declare more than one role.
This is invalid:
@page
@component Hero(title)
The parser throws an error when more than one file declaration is found.