cargo install shrimpleNo external configuration needed: you have HTML, you have shrimple, you call it, and get a site ready to be deployed.
shrimpleThis will build the website with index.html as its root and paste the root and all the files it references into dist
shrimple has Lua evaluation built-in and it can be utilised in any part of any file: in text nodes, in attributes, inside strings, you name it! (TODO: eval in attr & element names)
Use $VAR to access a Lua variable, and $(code) to evaluate arbitrary Lua code and paste its return value
$(
SHRIMP = "shrimp.png"
SHRIMP_SIZE = 100
)
<svg width=$SHRIMP_SIZE height=100%>
<image
href=$SHRIMP
width=$SHRIMP_SIZE height=$SHRIMP_SIZE
transform="rotate(-30 $(SHRIMP_SIZE / 2) $(SHRIMP_SIZE / 2))"
/>
</>No need to deliberately specify index.css, image.png, etc. as an asset: if you mention it in HTML, it'll be registered automatically.
In the example above, the file shrimp.png is mentioned in image element's href attribuet, so it will automatically be searched
in the same directory where index.html is, and will be copied to the output directory.
If the asset is somewhere out there on the vast plains of the Internet, and you wish to make sure it's always available to your users,
you can cache it! just prefix the attribute containing the link with $cached, and you're all set.
The CLI comes with a very handy flag: call shrimple -w or shrimple --watch to spin up a lightweight local server
that'll recompile your website as needed and show it to you right in the browser.
The subset of HTML accepted by shrimple is intended to smoothe out irregularities & verbosity of
the standard HTML. The changes that make it shrimple are:
- No syntactical difference between normal and void elements: all elements can be self-closing, and most can also end in a closing tag.
- No need to specify the element name in the closing tag
(
<title></>possible instead of<title></title>), though specifying it is allowed. - No need for top-level
<html>,<head>or<body>: they're inserted automatically into the compiled HTML. - The encoding of the document is automatically set to UTF-8.
- Markdown in text nodes is compiled to HTML
This snippet of shrimple HTML:
<title>Hello World</>
## Hello, *World*!Is equivalent to this snippet of standard HTML:
<!DOCTYPE html/>
<html>
<head>
<meta charset="UTF-8"/>
<title>Hello World</title>
</head>
<body>
<h2>Hello, <em>World</em>!</h2>
</body>
</html>Check out the docs
And consider donating to boost the development of this ambitious little tool
