larowlan / vite-plugin-twig-drupal

Provides a vite plugin for rendering Drupal flavoured twig files with Storybook
MIT License
15 stars 4 forks source link

Unable to correctly parse dynamic import #18

Open larowlan opened 3 months ago

larowlan commented 3 months ago
{% include 'images/animated-icon-' ~ modifier_class ~ '.svg' %}

When we spot includes this ends up being images/animated-icon-

norbertschad commented 3 months ago

Don't now whether it helps, but I've found that pluckIncludes(template.tokens) will deliver an array with the single parts of the import file instead of the resolved filename.

[  'images/animated-icon-',
   'modifier_class',
   '~',
   '.svg'
]

As the first element is then used to load the first include, of course the file is not found.

larowlan commented 3 months ago

Yeah that's consistent with what I was seeing too - thanks

dantedubonc commented 1 week ago

Is there a fix or workaround for this?

larowlan commented 1 week ago

Not yet