YR SYNTAX
REFERENCE.
Yr is a
DSL
(domain-specific language) for structuring full-stack projects. You write HTML, CSS, JS, Python, and Bash as you normally would — Yr just gives them a place to coexist in a single
.yr
file, separated by section markers.
Early stage:
no variables or loops yet. What's here works and is used in production.
A
.yr
file is a collection of sections. Each section starts with a two-character marker and contains the code for that layer of your project. The Yr compiler reads each section and outputs the appropriate files.
Content placed inside
<body>
, before the footer section. Use the
_
element selector to place HTML tags and wrappers.
Content placed inside
<head>
. Use for meta tags, external stylesheets, fonts, etc.
Standard CSS. Injected as a
<style>
block before
</head>
. Write any valid CSS.
Client-side JavaScript. Placed after
</body>
as a
<script>
block. Runs in the browser.
@>
for JS placed before
@@
, and
@<
for JS placed after.
Server-side Node.js logic. Compiled as
app.js
. Write Express routes, middleware, or any server code.
&>
before,
&<
after the main
&&
block.
Scripts for build, serve, and deploy stages. Use
___stageName
to specify which stage. Default is
build
.
Use
#!language
to specify which language. Default is
bash
.
build
,
serve
,
deploy
.
build
runs when
yr.build
is called.
Placed inside the HTML output before
<head>
. Useful for tracking pixels and doctype overrides.
Placed after
</body>
. For inline
<script>
blocks that should load last.
Defines the structure of a reusable wrapper file. Use
___
to mark where a child element will be inserted. If no
___
, children append to the last root element.
Imports another
.yr
file. Wrappers must be capitalized. Use
!! @wrapper
for the special wrapper macro.
Places HTML elements or wrapper components. Use inside HTML sections (
><
,
++
). Supports standard HTML tags and wrapper paths.
Reusable functions available across all sections. Define with
_@name()
, end with
@}
. Variables prefixed with
#
. Use
___
for code insertion.
false
.
Install npm dependencies at build time. Comma-separated list.
Declare wrapper-level variables. Must be on the first line of the file.
icon
(Bootstrap icon name) ·
attributes
(list of wrapper attributes) ·
disable_children
(toggle child support, default false)
Conditional logic based on environment (
options.env
).
??
= if,
?_
= else,
//
= end.
Reserved for Ethereum and blockchain-related logic. Not yet implemented.