Skip to content

How to use shorthand syntax outside of patternlab itself? #54

@andriokha

Description

@andriokha

Hi,

Thanks for all the work that's gone into this project!

I was hoping to use the shorthand include syntax outside of Pattern Lab (in Drupal as it happens). I found the same request from 2016 in pattern-lab/edition-php-twig-standard#18. In that issue there's a workaround suggested and the issue was closed.

I was just wondering if there was any interest in trying to go further and make the pattern partial loader itself available to consumers such as Drupal? I've done a simple PoC that seems to work for me:

  1. pattern-lab-php-path-src-exporter: A PL listener that dumps the pattern paths data (ie the second argument to \PatternLab\PatternEngine\Twig\Loaders\Twig\PatternPartialLoader::__construct()) to a file.
  2. patternlabloader: A Drupal module that extends PatternPartialLoader to read the location of the pattern paths data file from the theme info file, and use it to construct the loader.

I'm quite new to Pattern Lab, maybe there's a better way to do this? At the moment a pain point is obviously that to get the partial loader and utility class you need patternengine-twig which needs core + deps, and really this is all for two classes: \PatternLab\PatternEngine\Twig\Loaders\Twig\PatternPartialLoader and \PatternLab\PatternEngine\Util.

Would there be any chance we could grab the pattern partial loader without the rest of pattern lab? Any advice/suggestions?

Thanks for your time and consideration!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions