pattern-lab / patternlab-node

The Node version of Pattern Lab
http://patternlab.io
MIT License
2.05k stars 406 forks source link

[Engine Twig PHP] Movgin from 5.15 to 6.0.1 - Pattern lab config issue #1510

Open DarkteK opened 1 week ago

DarkteK commented 1 week ago

Hi Everyone!!

Actual Behavior

I am currently using:

"@pattern-lab/core": "^5.15.0",
"@pattern-lab/engine-twig-php": "^5.15.0",
"@pattern-lab/uikit-workshop": "^5.15.0",

And I have my pattern-lab configuration on-going properly. But I'm starting to see some deprecated msgs because I'm using an older version, so I wanted to upgrade those three engines up to 6.0.1 to say the least. But I'm getting a new error stating:

Engine twig not configured correctly. Please configure your engines in patternlab-config.json as documented in https://patternlab.io/docs/editing-the-configuration-options/#heading-engines

If I go into that specific site this is the only example I get:

 "engines": {
    "handlebars": {
      "package": "@pattern-lab/engine-handlebars",
      "fileExtensions": [
        "handlebars",
        "hbs"
      ],
      "extend": "helpers/*.js"
      ...
    }
  }

And that doesn't help me too much because this is my current engine object:

Steps to Reproduce
"engines": {
    "twig": {
      "namespaces": [
        {
          "id": "uikit",
          "recursive": true,
          "paths": [
            "./node_modules/@pattern-lab/uikit-workshop/views-twig"
          ]
        },
        {
          "id": "atoms",
          "recursive": true,
          "paths": [
            "./src/pattern-lab/_patterns/00-atoms"
          ]
        },
        {
          "id": "molecules",
          "recursive": true,
          "paths": [
            "./src/pattern-lab/_patterns/01-molecules"
          ]
        },
        {
          "id": "organisms",
          "recursive": true,
          "paths": [
            "./src/pattern-lab/_patterns/02-organisms"
          ]
        },
        {
          "id": "templates",
          "recursive": true,
          "paths": [
            "./src/pattern-lab/_patterns/03-templates"
          ]
        }
      ],
      "alterTwigEnv": [
        {
          "file": "alter-twig.php",
          "functions": [
            "addCustomExtension"
          ]
        }
      ]
    }
  }
Expected Behavior

Could you tell me how modify or make my configuration works using the newer pattern-lab versions please? Let me know if you want me to post the entire pattern-lab.config and I'll do it.

hadl commented 6 days ago

@DarkteK should look like this https://github.com/pattern-lab/patternlab-node/blob/06fdb6909353fc3316476676f854392fb68bb2b2/packages/edition-twig/patternlab-config.json#L3-L7