Skip to content

Views

Views separate your controller from HTML. Almasix’s view engine is Prism — templates compiled to Python (.prism.html).

app/http/controllers/welcome_controller.py
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.

resources/views/welcome.prism.html
@extends("layouts.app")
@section("content")
<h1>{{ title }}</h1>
@endsection

The second argument to view() is a dict of template data. Helpers such as url, asset, e, and __ are injected automatically for Prism templates.

  • {{ value }} — HTML-escaped (safe default)
  • {!! value !!} — raw HTML (only when you trust the content)

html() is for small hand-built fragments or low-level responses. Prefer view() for pages, layouts, and components.

This Basics page is the entry point. Full Prism documentation lives in its own section: