Pixy compiles .pixy templates to native Go code to profit from type system checks and high performance DOM rendering.
The generated code usually renders templates 300-400% faster than Jade/Pug due to byte buffer pooling and streaming.
If you're looking for the official compiler, please install pack.
A pixy template is a collection of components.
component Hello(person string)
	h1= "Hello " + personYou can define multiple components in a single file:
component Hello
	h1 Hello
component World
	h1 WorldAnd combine multiple components in one:
component Layout
	html
		head
			Title("Website title.")
		body
			Content("This is the content.")
			Sidebar("This is the sidebar.")
component Title(title string)
	title= title
component Content(text string)
	main= text
component Sidebar(text string)
	aside= textAdd IDs with the suffix #:
component Hello
	h1#greeting Hello WorldAdd classes with the suffix .:
component Hello
	h1.greeting Hello WorldAssign element properties:
component Hello
	h1(title="Greeting") Hello WorldUse Go code for the text content:
component Hello
	h1= strconv.Itoa(123)Use Go code in values:
component Hello
	h1(title="Greeting " + strconv.Itoa(123)) Hello WorldEmbed HTML with the suffix !=:
component Hello
	div!= "<h1>Hello</h1>"Call a parameter-less component:
component HelloCopy
	Hello
component Hello
	h1 HelloCall a component that requires parameters:
component HelloWorld
	Hello("World", 42)
component Hello(person string, magicNumber int)
	h1= "Hello " + person
	p= magicNumberIterate over a slice:
component ToDo(items []string)
	ul
		each item in items
			li= itemIterate over a slice in reversed order:
component ToDo(items []string)
	ul
		each item in items reversed
			li= itemFor loops (each is just syntactical sugar):
component ToDo(items []string)
	ul
		for _, item := range items
			li= itemIf conditions:
component Condition(ok bool)
	if ok
		h1 Yes!
	else
		h1 No!components, err := pixy.Compile(src)Please take a look at the style guidelines if you'd like to make a pull request.
| Cedric Fung | Scott Rayapoullé | Eduard Urbach | 
Want to see your own name here?