Jump to content

Modular template snippets


Kurbel
 Share

Recommended Posts

Hey,
this is a bit of a long winded and rather general question and I'm not sure if it fits into this category.

I'm in the process of developing a little sideproject with NuxtJS and Tailwind, however I feel slightly (read: very much) frustrated because the entire ecosystem seems to explode constantly and everything is broken all the time. /rant over

So I'm thinking about switching the entire thing over to Processwire and start from scratch. What I did like however is the approach of having reusable components (like a button, a hyperlink, ...) and using those to compose bigger elements (e.g. a teaser, a tile, ...). That's probably the one thing about Vue + Tailwind that I loved really.

In principle this seems to be archivable with 

$files->include()

, e.g. so I'd include a teaser, which would then include a button, a headline and a text...

However how do you make the entire thing typesafe or at least have some kind of fail early and useful typehints? Define value objects for everthing?

Am I overthinking this entire thing? 

How do you people manage more complex setups without losing your mind? ?

Link to comment
Share on other sites

I'm not 100% sure I understand you in full detail but there is a site profile (site-regular) in which Ryan uses reusable functions for all kind of things he needs and renders for that profile. In this case it's getuikit.com.

Look at his _uikit.php over on Github to get an idea what he's doing there.

https://github.com/processwire/processwire/blob/master/site-regular/templates/_uikit.php

Link to comment
Share on other sites

There are a few ready-made ways to have composable components in PW:

  1. https://processwire.com/api/ref/wire-file-tools/render/ (native built-in)
  2. https://wireframe-framework.com/docs/view/components/
  3. https://processwire.com/modules/twack/
  4. https://github.com/wanze/TemplateEngineFactory/blob/master/DOCUMENTATION.md#controllers

But they are probably not exactly the same thing as in NuxtJS as this is PHP.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...