Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: How does slippers solve the motivating example? #50

Open
jmuncaster opened this issue Aug 1, 2023 · 3 comments
Open

Docs: How does slippers solve the motivating example? #50

jmuncaster opened this issue Aug 1, 2023 · 3 comments

Comments

@jmuncaster
Copy link

In the docs I see this:

... Templates [...] are built and then included wherever they are needed.

{% url "project:add_data" as add_data_url %}
{% include "patterns/molecules/button/button.html" with label="Add data" href=add_data_url %}

And then it goes on to say:

As you can see, the syntax for this is quite verbose.

It would be great to see this exact example written in slippers. Perhaps I'm missing something really trivial, but I cannot see how the slippers code is much less verbose. Wouldn't it look like this?

{% url "project:add_data" as add_data_url %}
{% button with label="Add data" href=add_data_url %}

I can see how you don't have to type the full path to the partial, but everything else is more or less the same, which doesn't seem to support the verbosity claim very well. Am I missing something?

@mixxorz
Copy link
Owner

mixxorz commented Aug 2, 2023

Not having to include the full path to the partial is a big deal if you're using a lot of {% include %} statements in your templates. It may not look like much from a single example, but having to write the path to the button component 30 times instead of just writing {% button %} is not insignificant in my opinion.

You also don't need with.

(Slightly unrelated, but the docs could be better written. Including this section.)

@jmuncaster
Copy link
Author

Thanks, I have begun to integrate slippers more and I can see how it reduces code (although at the expense of not being able to Cmd+Click the path in my IDE to bring the editor to the source).

I do think that the docs should show the solution to their motivating example. I wouldn't say this is unrelated, the clarity of the docs is exactly what this issue is about. The request would be to solve the motivating example in the docs, and/or lead with another example that better showcases this great library.

@boosh
Copy link

boosh commented Apr 30, 2024

I came looking for this explanation. The library sounds like it should be useful, but TBH from reading the docs I'm not clear exactly on why it's better than just using include (it might become clearer once I build a more complicated frontend).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants