kalamuna / kalastatic

:electric_plug: Facilitate the front-end experience through Styleguides and Prototypes
https://kalamuna.github.io/kalastatic/
41 stars 14 forks source link

Inklude #482

Open soniktrooth opened 7 years ago

soniktrooth commented 7 years ago

We want to handle template inclusion for both prototype and Drupal. We have a notion of writing a custom function to include templates that can hide the ugliness.

{% inklude('template.html.twig', vars) %}

We should try and nail down a set of features or approaches here.

thiagodemellobueno commented 7 years ago

I propose

{% inklude('type','template', contextvars) %}

with optional namespace?

{% inklude('type','template', contextvars, namespace) %}
soniktrooth commented 7 years ago

@thiagodemellobueno what is type in your proposal?

RobLoach commented 7 years ago

We'd need to implement this in three different places:

  1. Drupal - Implement it in PHP Twig
  2. Prototype - Implement it in kalastatic-twig-filters
  3. Styleguide - We could likely use kalastatic-twig-filters and use KSS's --extend to add it in

Using a macro is another quick and dirty solution too.

hawkeyetwolf commented 7 years ago

The idea of using a function is that we actually do want to implement it differently in Drupal land vs. the others. This would let us set up one definition of inklude() via PHP (for the Derps) and another in JS (for KSS and metalsmith). The former would call Drupal 8's version of D7's render(), while the latter would simply be wrapper for Twig's include() function (not the include statement). FYI last I checked, the include statement still wasn't ported to TwigJS.

RobLoach commented 7 years ago

last I checked, the include statement still wasn't ported to TwigJS

Yup, missing in TwigJS....

I can work on adding that.

RobLoach commented 6 years ago

https://www.mediacurrent.com/blog/accommodating-drupal-your-components

Uses https://twig.symfony.com/doc/2.x/tags/embed.html with

thiagodemellobueno commented 6 years ago

To answer Josh's old question: Type was supposed to be "molecule, atoms, organisms" etc.... basically the minimum information we need to build paths, or summon the right namespace. I guess we can switch it to namespace.