drupal-pattern-lab / roadmap

2 stars 0 forks source link

Discuss best way to start a PL Drupal project #5

Open EvanLovely opened 7 years ago

EvanLovely commented 7 years ago

Now that we've discussed and agreed that supporting the Twig Edition fork is to be our focus for a starting Pattern Lab, let's discuss how we suggest people get started using Pattern Lab in Drupal. The Drupal Edition of Pattern Lab is basically just the Twig Edition with these extra dependencies, which are suggestions and not requirements: drupal-twig-components, plugin-data-transform and Drupal-specific StarterKit suggestions.

How best to handle this?

@cybtachyon had wrote:

One thing I dislike though

we have documentation on how to integrate the Twig Edition into Drupal and the different plugins that are useful for when working in Drupal.

Code > Documentation. I would maybe suggest a secondary goal for this project of creating a gulp/etc. tool that can be added to any Drupal theme to enable Pattern Lab support, while avoiding creating actual wrappers as a Drupal Edition like there are Angular, React etc.

I think that the best way to support getting people going using Drupal + Pattern Lab would be to make a Yeoman Generator for a Drupal Theme that would ask questions, then install and scaffold out the necessary pieces. I think this is the perfect time to use a npm module name I've been holding onto for a good use like this: generator-theme - which would get used as yo theme. It could even ask if you wanted a Pattern Lab at all. I think the main use case would be a Drupal theme with Pattern Lab of course, but this could ask several questions and then set up something awesome. Here's some questions it could ask:

Please note that this relates to the tooling discuss in #3 - however that is about tooling that would be used on day-to-day development of the Pattern Lab they kicked off: watch & rebuild Pattern Lab, watch & rebuild CSS, etc. This discussion is about tooling that would create a Drupal theme that uses Pattern Lab OR a Drupal - ready Pattern Lab or something like that. Thoughts? @sghoweri @evanmwillhite @aleksip

sghoweri commented 7 years ago

@EvanLovely @aleksip @evanmwillhite maybe this is a dumb "Chicken or the Egg" question but I'd kinda first pose the question:

"What's the minimum amount of things required in a barebones Drupal 8-friendly / standalone Pattern Lab theme" vs recommended or optional add-ons.

Just thinking out loud: A. What if we had a vanilla Pattern Lab powered theme (ie. like a stripped away / merged version of Pattern Lab Starter + Emulsify) that had everything boiled away but the necessities so things can be added in as needed vs having to remove code the user doesn't want or need (something I think @EvanLovely mentioned during one of the Drupalcon BoFs).

What might that theme look like at the file level? And what files would need to be included for this PL as a Drupal Theme to work properly (ie. screenshot.png, logo.svg, favicon, theme.info.yml, theme.libraries.yml, etc) + composer dependencies like the Drupal Twig extensions plugin?

B. On top of that, what add-ons are recommended but not required to make this whole setup easier? --> ex. the Data Transform plugin or the Twig namespaces plugin or the solution we came up w/ for sharing Twig extensions between Drupal and PL

C. Finally, what optional things could be further added on that solve for different needs, etc. Faker plugin? Build tools?

^-- I'm just wondering if it'd be easier to start with a static repo (or repos) example with these things dropped in and then codify the options via Yeoman (which I'm all for) OR we start small via Yeoman questions and build up that way.

EvanLovely commented 7 years ago

Basic theme + PL would require:

Wouldn't need Gulp, but as soon as some added something like Sass, then they'd have two Terminal tabs open: one for Gulp, one for PL.

For B, it gets tough because if you have a list of suggestions, it's all docs to follow. I like the idea of a Yeoman generator. Definitely start small and build up though.

sghoweri commented 7 years ago

@EvanLovely right. Agreed. That's why I was thinking about starting small first so we can on your bullets first before the more opinionated bits.

As far as Yeoman tasks are concerned, I wonder if we could handle these modularly via Lerna for practice, similar to how I was thinking we could handle our Gulp tasks. Haven't found any actual Lerna + Yeoman examples but it'd be something similar to:

https://github.com/build-boiler/making-gulp-suck-less/tree/master/packages https://github.com/cloudflare/cf-ui/tree/master/packages

evanmwillhite commented 7 years ago

I think this might be the part where approaches starts to diverge depending on personal/company usage. Our approach with Emulsify was that it was first/foremost a prototyping tool (that just happens to double as a Drupal theme only b/c it is very little overheard for it to do so).

I'd personally rather have a simple install baseline prototyping tool (w/o the overhead/maintenance of a Yeoman generator) and then just add dependencies as needed per situation (Wordpress, Drupal, etc.). So installation could be:

  1. Clone/install prototyping tool with baseline PL installation/automation (I like how simple this is now with PLS/Emulsify honestly).
  2. Install dependencies as needed for given situation, so if Drupal, install Drupal-specific plugins, etc. (same for CSS/JS dependencies assuming we split those off).

Don't get me wrong - I think the tool you're talking about building could be majorly useful. But maybe it might be getting too specific to a certain need to be "the recommended approach"?

sghoweri commented 7 years ago

@evanmwillhite This is definitely a key reason why I'm pushing we do things in smaller, composable parts (Pattern Lab Twig Edition separate from a tiny Gulp core separate from the different Gulp tasks, etc)

That way we can put together larger more opinionated examples like the rough vanilla D8 theme I started futzing with while still hopefully providing some value if that doesn't quite fit the bill.

EvanLovely commented 7 years ago

I've got a Yeoman Generator (among other things for #3 ) up and ready for some review if anyone could: https://github.com/drupal-pattern-lab/theme-tools/issues/1