pattern-lab / patternlab-php

The PHP version of Pattern Lab
http://patternlab.io
MIT License
3.05k stars 456 forks source link

Best Practice - Laravel #387

Open matrad opened 7 years ago

matrad commented 7 years ago

Hello,

in the issues of this project I see a lot of questions how we deploy integrate the code in our cms.

2-3 years ago the answers say that PL is only for frontend devs and not for backend devs.

Now the things changed, we are able to integrate it directly in a backend (Mustache, Twig).

I've a Project based on laravel; what is now the best practice integrating the template of a PL project?

Is it still the best to export the template via gulp as static resources and embedd then in our page?

Please note that laravel has the blade template engine by default.

Thanks.

bradfrost commented 7 years ago

Hey @matrad, Thanks for the question. The way Pattern Lab is set up means different template engines can be created to power Pattern Lab. That being said, I don't know if anyone's created a Bade templating engine for Pattern Lab.

Other people have integrated Pattern Lab with CMS projects, so it's technically possible. You would need to create the Blade engine for Pattern Lab in order to make it a smooth transition however.

KatieMFritz commented 7 years ago

@matrad This might be relevant: http://cognition.happycog.com/article/solr-laravel-pattern-lab-more-buzzwords

simonhunt commented 5 years ago

I keep coming back to the idea of using Patternlab with Laravel but it seems as though there still isn’t a blade integration.

So, option 1 is to use Twig instead of blade in laravel.

But, option 2, to get blade running inside Patternlab seems so much more preferable.

Where is the best place to start if I want to build a blade templating engine for Patternlab? I’d be happy to build this if someone can point me at some resources about how to get started.

bradfrost commented 5 years ago

Hey @simonhunt,

So, option 1 is to use Twig instead of blade in laravel.

We just launched a project that did exactly this. I can't speak to the Laravel side of things, but the dev consumed PL as a project dependency and overwrote only the data that needed wired up (usernames, routes, etc). It was pretty great!

But, option 2, to get blade running inside Patternlab seems so much more preferable.

Yep, creating a Blade engine for PL would be the way to go. I'm not sure if there's official documentation on creating a pattern engine (@bmuenzenmeyer would know), but you can check out a few others: https://github.com/pattern-lab/patternengine-php-twig https://github.com/pattern-lab/patternengine-node-handlebars and others on the PL Github page: https://github.com/pattern-lab

antoine3000 commented 5 years ago

Hey @simonhunt, a blade templating engine for Pattern Lab would be perfect for Laravel based projects. I'm also looking for it since few months but didn't had time & resources to do it. So just to let you know that I support this idea and if I can, I'll be here to help.