Replies: 1 comment
-
|
Slim uses a flexible transformation pipeline, see https://github.com/slim-template/slim/blob/main/lib/slim/engine.rb. So it would be possible to add a custom filter which performs the transformation you have in mind. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This issue is an idea for a feature, and it's in a really crude phase intended to trigger a discussion.
I use the ViewComponent library a lot - it is very useful, but I've found that rendering them is pretty cumbersome and it pollutes templates a lot. I also use JSX, and its approach gave me an idea: Slim could, in an opt-in fashion, also make use of the fact that HTML tags are usually lowercase, so uppercase tags offer a new, vacant namespace.
So what we write now like this:
could be written like this:
As is evident even from this small example, there would have to be a syntax addition for the block parameter. Other approaches are possible for this, including:
An ideal implementation wouldn't hardcode ViewComponent as an optional dependency, but would rather allow the user to define a handler (or override the default one) for uppercase tags, should they opt to switch on the feature.
Beta Was this translation helpful? Give feedback.
All reactions