emulsify-ds / emulsify-drupal

Drupal theme built with Storybook and Webpack
GNU General Public License v2.0
92 stars 42 forks source link

file.includes is not a function #159

Closed mralexho closed 4 years ago

mralexho commented 4 years ago

emulsify-drupal:^2.0

node version: v14.8.0

yarn version: v1.22.4

What you did: Manually upgrade emulsify-drupal from ^1.0@beta to ^2.0

What happened: Experiencing errors with file.includes is not a function

Problem description: Hi @evanmwillhite, I found your ticket https://github.com/twigjs/twig.js/issues/682 about nested includes and was wondering if you found a solution already. I was able to fix by removing namespaces in one of my components. I tried reverting twigjs from v1.15.2 to v.1.13.3 but that seemed to cause other problems.

I noticed in this repo's components, the article page include a grid organism, which include a heading atom so it doesn't seem like you're running into this issue anymore.

┆Issue is synchronized with this Jira Story by Unito

Exilent-Jask commented 4 years ago

Having same issue when using a block that uses embed multiple times

evanmwillhite commented 4 years ago

I didn't notice it as much on a newer project I worked on, which made me wonder if they slipped in a fix in one of the Twig.js releases. But if they haven't and you still experience the issue, the workaround we were using basically just moves to using extends instead of embed on any nested files so something like this:

From:

{% embed "@whatever/file.twig" with {
  variable1: 'something'
} %}
 {% block ... %}
 {% endblock %}
{% endembed %}

To:

{% set variable1 = 'something' %}

{% extends "@whatever/file.twig" %}
  {% block ... %}
  {% endblock %}
mralexho commented 4 years ago

@evanmwillhite okay I just realized namespaces is not the culprit but rather including templates with embed. I see your modifications https://github.com/emulsify-ds/emulsify-drupal/pull/103/commits/2bcf6dd872acce3c476f860246cb14f0d649f080 to get it working.

I'll see if I can change our templates as they are pretty complex.

ccjjmartin commented 3 years ago

This PR fixes this issue for me: https://github.com/twigjs/twig.js/pull/784