Views
Views separate your controller from HTML. Almasix’s view engine is Prism — templates compiled to Python (.prism.html).
Creating and returning views
Section titled “Creating and returning views”from almasix.prism import view
async def index(self): return view("welcome", {"title": "Almasix"})Templates live under resources/views. Dots map to directories: view("posts.show") → resources/views/posts/show.prism.html.
@extends("layouts.app")
@section("content") <h1>{{ title }}</h1>@endsectionPassing data
Section titled “Passing data”The second argument to view() is a dict of template data. Helpers such as url, asset, e, and __ are injected automatically for Prism templates.
Escaping
Section titled “Escaping”{{ value }}— HTML-escaped (safe default){!! value !!}— raw HTML (only when you trust the content)
When to use html()
Section titled “When to use html()”html() is for small hand-built fragments or low-level responses. Prefer view() for pages, layouts, and components.
Deep dive
Section titled “Deep dive”This Basics page is the entry point. Full Prism documentation lives in its own section:
- Prism — overview
- Rendering Views
- Layouts & Inheritance
- Components & Slots
- Control Structures
- Including Subviews
- Stacks & Directives