CORE CONCEPTS
Static Assets
Rasengan.js allows you to serve static files like images, fonts, and other assets from a special folder called public
.
Any file placed inside the public
folder is automatically available at the base URL (/
). This means you don’t need to import assets manually or use special loaders—just reference them directly in your code.
If you have an image located at:
txt/public/avatars/1.png
You can access it in your browser at:
txt/avatars/1.png
And use it in your code like this:
jsximport { Image } from "@rasenganjs/image"; export function Avatar({ id, alt }) { return <Image src={`/avatars/${id}.png`} alt={alt} width={64} height={64} />; }
- Store all static assets inside the
public
folder to keep them easily accessible. - Use relative paths (
/your-file.png
) instead of importing images directly. - Optimize images to reduce load times and improve performance.
This feature makes it easy to serve assets without additional configuration! 🚀
Metadata
Typescript