EvanLovely / plugin-twig-namespaces

Pattern Lab plugin for registering new Twig Namespaces
MIT License
8 stars 1 forks source link

Issue with relative paths after upgrade to v1.1.0 #5

Open B-Prod opened 6 years ago

B-Prod commented 6 years ago

Switching from version 1.0.0 to 1.1.1 make the compilation fail.

All the paths used to find the templates are wrong. Here is an example:

configuring pattern lab... PHP Fatal error: Uncaught exception 'Twig_Error_Loader' with message 'The "../source/_patterns/00-base" directory does not exist ("/Users/xyz/mypath/../source/_patterns/00-base").' in /"/Users/xyz/mypath/pattern-lab/vendor/twig/twig/lib/Twig/Loader/Filesystem.php:101 Stack trace:

0 /"/Users/xyz/mypath/pattern-lab/vendor/evanlovely/plugin-twig-namespaces/src/PatternLab/TwigNamespaces/PatternLabListener.php(64): Twig_Loader_Filesystem->addPath('../source/_patt...', 'base')

1 [internal function]: PatternLab\TwigNamespaces\PatternLabListener->addTwigNamespaces(Object(Symfony\Component\EventDispatcher\Event), 'twigLoaderPreIn...', Object(Symfony\Component\EventDispatcher\EventDispatcher))

2 /"/Users/xyz/mypath/pattern-lab/vendor/symfony/ev in /"/Users/xyz/mypath/pattern-lab/vendor/twig/twig/lib/Twig/Loader/Filesystem.php on line 101

The directory structure is similar than the one defined in the README file:

── pattern-lab │   ├── composer.json │   ├── composer.lock │   ├── core │   ├── public │   └── vendor ├── source │   ├── _annotations │   ├── _data │   ├── _layouts │   ├── _macros │   ├── _meta │   ├── _patterns │   ├── _twig-components │   ├── favicon.ico │   └── styleguide

Reverting to the 1.0.0 version fixes the issue and the compilation succeed.

tanc commented 6 years ago

Confirmed that 1.1.x breaks gulp compilation for me too. Reverting to 1.0.0 allows it to work

RedLucas commented 6 years ago

I also dealt with this issue on 1.1, will need to revert it.

illepic commented 6 years ago

Same here. Running composer upgrade for the first time since November 2017 to update composer.lock with this upgrade info:

capto_capture 2018-03-01_08-36-13_

Results in this relative path error on compile:

capto_capture 2018-03-01_08-39-49_

Upgrading all all dependencies except this one works fine again.

illepic commented 6 years ago

Quick note, update your require entry to:

"evanlovely/plugin-twig-namespaces": "~1.0.0"

And then run composer update to lock to patch level updates only.

tjheffner commented 6 years ago

Adding an explicit "baseDir" key to pattern-lab/config/config.yml helps get around the missing directory error on 1.1.1, but appears to break how the styleGuideKitPath get rendered. Is there a feasible way to resolve the baseDir path rather than concatenating?