Giter Site home page Giter Site logo

Comments (14)

tanc avatar tanc commented on June 12, 2024 1

If its hard coded in ThemeManager I can't see any easy way. A real shame as UI Patterns seems like a great way of wiring Pattern Lab and Drupal together.

from ui_patterns.

ademarco avatar ademarco commented on June 12, 2024 1

Maybe you can open an issue on PatternLab referencing this one?

from ui_patterns.

tanc avatar tanc commented on June 12, 2024

My use statement in my yml file looks like:
use: "@organisms/paragraphs/text-image/text-image.twig"

The error thrown is: Twig_Error_Loader: Template "themes/custom/ics_theme/source/_patterns/03-organisms/paragraphs/text-image/text-image.twig/text-image.twig.html.twig" is not defined

from ui_patterns.

ademarco avatar ademarco commented on June 12, 2024

Ha! Nice catch! .html.twig is a Drupal thingie indeed, I'm gonna get rid of it at once! 😄

from ui_patterns.

ademarco avatar ademarco commented on June 12, 2024

@tanc PR created, could you please check if that works for you? Thanks!

from ui_patterns.

tanc avatar tanc commented on June 12, 2024

There must be a bit more to it as that results in the following error:

Twig_Error_Loader: Template "themes/custom/ics_theme/source/_patterns/03-organisms/paragraphs/text-image/text-image.html.twig" is not defined

For some reason the .html is still there but the directory structure is now correct.

from ui_patterns.

ademarco avatar ademarco commented on June 12, 2024

Yeah I guess that's not really the right fix then. Actually the .html.twig extension is kind of hardcoded in the ThemeManager class, see \Drupal\Core\Theme\ThemeManager::render():

    }
    else {
      $render_function = 'twig_render_template';
      $extension = '.html.twig';

      // The theme engine may use a different extension and a different
      // renderer.
      $theme_engine = $active_theme->getEngine();

So I guess you'll have to name your templates accordantly, would that be possible?

from ui_patterns.

tanc avatar tanc commented on June 12, 2024

Ah right. That would be a shame as the name of the template is taken from the file name in Pattern Lab so file names would have html in them, like this:

pattern_lab_-_pages-basic-page

from ui_patterns.

ademarco avatar ademarco commented on June 12, 2024

I see, any way you can override that in PatternLab?

from ui_patterns.

tanc avatar tanc commented on June 12, 2024

Yes, I can specify the file name in a .md file alongside it. The main problem is I then have to rename all my supporting files to have the .html part of the filename which is HORRIBLE!

text-image_html_md_-web-___sites_l_ics_gitroot_web

from ui_patterns.

ademarco avatar ademarco commented on June 12, 2024

I wonder if there is anything I can do on my side but I guess not since anyway Drupal will try to find files with that extension, right?

from ui_patterns.

aleksip avatar aleksip commented on June 12, 2024

@tanc I agree that having to name files like that because of Pattern Lab is horrible! :)

I'd consider this an issue with Pattern Lab. The .html.twig extension is advocated in Symfony/Twig documentation, so the compatibility issue is not just with Drupal/UI Patterns.

from ui_patterns.

tanc avatar tanc commented on June 12, 2024

Ahah, good feedback. There is a config setting in Pattern Lab where you can define your extension (currently twig) but there has to be a matching pattern loader rule. I don't know enough about Pattern Lab to know if this is the right direction but it could be a solution.

from ui_patterns.

ademarco avatar ademarco commented on June 12, 2024

Closing as follow up has been opened on PatternLab's.

from ui_patterns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.