I love PL and the work that Dave and Brad have been doing. This is just random bullshit I've been thinking after a week of Pattern Lab use. Just
I've found that working on my current Pattern Lab, the only directory I really need is the source
directory. That makes me think that all the config|core|extras|etc
folders could not exist or be hidden from the user. That way a generic Node process that could be used by grunt, gulp, broccoli, etc might be beneficial. The "engine" is hidden from the user. Then updates could be seamlessly injected where now it'd be a bit of a manual process.
I think the simplicity of just having the files you're working on decoupled from the technology would be great for onboarding new users. Edit your source
files (now at the project root) and point a nodeapp/grunt/gulp task at it.
It feels like a question of do you want it to be WordPress for patterns (engine coupled) or a Jekyll for patterns (engine decoupled/hidden).
Relevant links:
I've wondered if it's easier to just update some JSON instead of keeping folder and file names numerically prefixed. If you delete a pattern, it's a bit of work to re-ordinate all the other files (lots of git changes, etc).
This would maybe help in up-cycling patterns into a larger system (which is a lot of people's dream). I can then tell a backend developer to include()
the molecules/global/pagination.mustache
instead of molecules/02-global/03-pagination.mustache/
, where the numbers seem subject to change. PL could then start existing within a directory of a larger system.
I talked with Brad about this, I know it's on the roadmap. I wonder if Jekyll's _plugins
structure might be good here, and those are little web components (HTML/CSS/JS ... Polymer?) that inject features in to the style guide header. Extensions could be included/excluded using YAML/JSON as well.
A bit to unpack here but I wanted to offer my two cents…
1. Just a Source Directory
I think we're just going to have to accept that there's a fundamental difference to how (I feel) the PHP world handles system-wide installs vs. node/Ruby. I think the examples given, Wordpress vs Jekyll, really highlight this. We shouldn't be saying PL works this one way across platforms but, rather, it should default to some sort of "best practice" for a language. If it's
gem install patternlab
and then you just have the commands? Two thumbs up. Same with node. If the node version should follow some other best practice and leverage the strengths of that platform we should do it. We (and the maintainer, Brian) do accept PRs ;)Frankly, that sounds to me like it's small potatoes on the vast list of questions that fall out of the larger question, "How do we think of maintaining a cohesive (not necessarily identical) project across platforms?"
2. YAML/JSON instead of Ordinal Folders?
Ordinal folder/patterns are not required to use Pattern Lab. At least the PHP version will work without them. The file system acts as the database for the nav so… if you want things to come in a certain order (e.g. templates before pages) you have to go for the numbers. As Brad noted, he matched it up to his previous version. But it can be dropped whenever. JSON sounds… indirect but it's possible to generate a JSON site map that gets hand-edited into the order one might want. Just have to make sure to keep existing orders during each build of the JSON to add new patterns.
And I can see you haven't seen pattern states (yellow dots on the home page template are a good example) and pseudo-patterns (primarily used for offering varied versions of a template/page) as they introduce more work on the file system.
3. Extensions?
Extensions/plug-ins are something that I've had rattling around in my head for a while. I just haven't spent on a ton of time on figuring it all out. Brad would say pattern states are a good candidate for a plug-in but I see that crossing so many parts of a system… it's tough to figure out how to deliver all of that and how to install it. I'm happy to follow the direction of someone else. And we can definitely split extensions between pure front-end and something more complicated like pattern states. Tackle one problem at a time. The QR code feature is a good one to use a test of modularizing the front-end specifically.
Actually, I'm shortly going to work in KSS support and maybe that's a good time to step back and think about how to do it in "plug-in" fashion since it, like pattern states, will touch on everything and only a subset of people will want to use it.I finally just did that for back-end engine support to allow patterns to be written in Twig.
4. Developing a Spec
What wasn't asked but seems to be an undercurrent to all of this is… what is Pattern Lab's (in general) spec? What qualifies as being Pattern Lab-compatible? Especially when it comes to being cross-platform and following a platforms best practices/norms? Right now it seems like there's a few… assumptions about how PL works based on docs, looking at the demo, and maybe some implementation aspects inherent in the current node version. I've really dropped the ball on a) developing a real spec and b) communicating changes to a spec. Brian has been left to pick apart and play catch-up on the PHP version. That isn't easy.
I'll take some time after I get back from holiday and write out what needs to go in and what needs to come out to be at the current version of PL. From there we can pick apart what's nice to have and what's necessary for delivering the core of PL (or a modular pattern builder thingie). That is developing and re-using patterns layered within the "viewer" for team and client review. We can then review where that leaves the node version and what we need to do to best push that forward to meet "node best practices" and the spec.
Thanks everyone for the input and feedback.