mhanberg
Expert LSP Core Team
I just released the first version of Temple: an HTML DSL for Elixir and Phoenix!
https://github.com/mhanberg/temple
You can read this blog post or the docs for more information!
Trending in Announcing
Hey everyone!
Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application.
This library uses Erlang esaml to provide
plug enabl...
New
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub.
Docs are at OpenaiEx User Gu...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi all!
I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas.
You...
New
Phoenix components for pagination, sortable tables and filter forms with Flop and (optionally) Ecto.
pagination
cursor pagination
sorta...
New
Other Trending Topics
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New
Hey folks,
I just published a post about Hologram’s funding and where the project goes next - the short version:
Curiosum as Main Spons...
New
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using.
We’re particularly inte...
New
This showed up on my feed.. anyone heard of it? Just hype?
Ox Alpha is a reasoning model designed for coding, sustained ag...
New
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
hauleth
Out of curiosity - what are the advantages over
Phoenix.HTML?mhanberg
This library is not a competitor to Phoenix.HTML, in fact Temple uses Phoenix.HTML as a dependency.
Temple needs to wrap Phoenix.HTML to make the functions work with the macros.
The reasons are related to how the markup is collected at runtime and there is some complexity around the anonymous functions used in the
form_forandinputs_forfunctions from Phoenix.HTML.fuelen
And the same question regarding to GitHub - zambal/eml: Library for writing and manipulating (html) markup in Elixir. · GitHub
mythicalprogrammer
Reminds me of an in between jade and haml.
Looks nice.
lucaong
Looks nice! Well done
About the existence of similar libraries, I think the fact that different authors experiment with different approaches is a positive sign of a good open-source ecosystem.
OvermindDL1
Ah I like code-syntax based DSEL’s like these, it makes it much easier to just use normal coding practices and functions instead of some unique syntax that makes it more difficult.
I’m guessing that it works by having each expression in the body list be placed into the final template, and something like
forthat returns a list just inlines each element of the list as a standalone expression?Why use
defcomponentover just a function call, or is it to work better with phoenix’s liveview stuff so you can inline it all more?In the example, could:
Be instead implemented just as:
And thus be used like
nav_item(item)ornav_item iteminstead?Is there any way to make it fail to compile if children are passed in when they aren’t used, or fail to compile if no children are passed in when they are required?
mhanberg
The macros expand to functions that when called, will emit markup into some state. If they are called inside a loop, they will be called multiple times.
defcomponentis used to create a macro likedivorspan, except it is given the name you pass, and the props you pass it are replaced in it’s body.If you create a function that calls the
templemacro, it will return{:safe, "your markup"}, but it will not be emitted into the end result unless you call it with thepartialmacro.will emit
It doesn’t do that right now, but I’m sure it’s possible!
darkmarmot
Just wanted to say that Temple looks awesome! I am pining for it to get LiveView integration
mhanberg
Just released v0.1.1!
Single arity tags will now escape content passed to them, functioning the same as calling the
textmacro.CHANGELOG
mhanberg
Just released v0.1.2!
Components now work correctly when
requireing their module (as opposed to callingimport).CHANGELOG