KP123
Question is pretty self explanatory. Temple is a view template library that feels like a more natural way to build markup in Elixir
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Quite interesting article Google brought me. Didn’t find any mentions about it here.
What do you think in general? Would you use togethe...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Since we have deprecated our Erlang sections (as we have dedicated Erlang Forums now) let’s add this thread for those who’d like to post ...
New
:warning: Security advisory: Decimal DoS vulnerability
A vulnerability has been published for decimal where very large exponents can cau...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
mhanberg
I do, but I am the author of the library
.
KP123
Can you note any major shocks someone coming from heex should expect when using Temple? How do the Javascript blocks work with %JS{} functions?
mhanberg
Nothing that I can think of.
One note tho is the attr and slot dsl do not work (the functions you put above a component).
mhanberg
These actually do work.
I don’t know if they’ve always worked or if something changed that made them work, but I’m pretty sure they work as of now.
jam
Looks really nice!
Is there more info on the
scriptmacro? Does it have any knowledge of the component it’s in or is it just JS?Any plans for adding a
stylemacro for scoped css?mhanberg
The tags are not actually macros, the
templemacro traverses the ast inside it and compiles it using whatever EEx engine you have configured.The script and style tags are just plain html tags, no special behavior.
I don’t have any plans regarding that, but you could probably define your own macro to do special compile time things if you wanted.
jberling
I didn’t know of this library. Just tried it out and it seems to work really nice! Thank you @mhanberg.
I’m all in for using an embedded language for these things, and implemented one for F# a looooong time ago: https://codeplexarchive.org/codeplex/project/wingbeats.
olivermt
Whats the upside of this over html templating? If someone has a sales pitch
mhanberg
jberling
In a language like Elixir where everything is expressions, it works really well to embed a little language that can easily be translated to HTML. One upside is that you can use Elixir’s control flows directly without escaping the template or relying on the template’s control flows.
I listened to an interview with Chris Lattner (the father of Swift), in which he said he regrets adding statements to Swift. Because of this, they had to add a lot of extra complexity on top of Swift to support Swift UI, where you can write view hierarchies directly in Swift.
I just tried Temple and I liked how easily it could co-work with existing HEEX templates. If you are curious you could try it out, perhaps in a messy view with logic, to see if you like it. Remember, Apple put a lot of effort into supporting something similar, so if it’s a new idea for you, it’s at least worth trying.