{"action":"created","issue":{"url":"https://api.github.com/repos/pattern-lab/patternlab-node/issues/208","labels_url":"https://api.github.com/repos/pattern-lab/patternlab-node/issues/208/labels{/name}","comments_url":"https://api.github.com/repos/pattern-lab/patternlab-node/issues/208/comments","events_url":"https://api.github.com/repos/pattern-lab/patternlab-node/issues/208/events","html_url":"https://github.com/pattern-lab/patternlab-node/pull/208","id":121168921,"number":208,"title":"PatternEngines ongoing work, round 4","user":{"login":"geoffp","id":76232,"avatar_url":"https://avatars.githubusercontent.com/u/76232?v=3","gravatar_id":"","url":"https://api.github.com/users/geoffp","html_url":"https://github.com/geoffp","followers_url":"https://api.github.com/users/geoffp/followers","following_url":"https://api.github.com/users/geoffp/following{/other_user}","gists_url":"https://api.github.com/users/geoffp/gists{/gist_id}","starred_url":"https://api.github.com/users/geoffp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoffp/subscriptions","organizations_url":"https://api.github.com/users/geoffp/orgs","repos_url":"https://api.github.com/users/geoffp/repos","events_url":"https://api.github.com/users/geoffp/events{/privacy}","received_events_url":"https://api.github.com/users/geoffp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-12-09T06:18:09Z","updated_at":"2015-12-09T20:48:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pattern-lab/patternlab-node/pulls/208","html_url":"https://github.com/pattern-lab/patternlab-node/pull/208","diff_url":"https://github.com/pattern-lab/patternlab-node/pull/208.diff","patch_url":"https://github.com/pattern-lab/patternlab-node/pull/208.patch"},"body":"Here's the first cut of a working Handlebars plugin, plus a file-based unit test (@bmuenzenmeyer: doing it right?). It's just enough right now to prove that we can render a \"hello world\" atom and a \"hello worlds\" molecule that includes it twice as a partial.\r\n\r\nHighlights:\r\n* @sghoweri's pattern_assembler fix is included\r\n* The Handlebars testing pattern tree tries to exactly emulate the structure of a real one, even though it's tiny\r\n* As in some of the nicer existing tests, the hbs tests set up a fake patternlab object and manually run process_pattern_iterative() and process_pattern_recursive().\r\n* These tests are replicating kind of a lot of buildPatterns() in patternlab.js. I wonder if there are some opportunites to refactor to make that process more testable, but I'm not sure exactly what they might be right now. I'm brain-fried for the day.\r\n\r\nTODO:\r\n* Since I think we don't want to have every template engine ever as npm deps by default (right?), we probably shouldn't fail the build if, say, handlebars wasn't installed by the end user. I've included it in package.json for just during development."},"comment":{"url":"https://api.github.com/repos/pattern-lab/patternlab-node/issues/comments/163387562","html_url":"https://github.com/pattern-lab/patternlab-node/pull/208#issuecomment-163387562","issue_url":"https://api.github.com/repos/pattern-lab/patternlab-node/issues/208","id":163387562,"user":{"login":"geoffp","id":76232,"avatar_url":"https://avatars.githubusercontent.com/u/76232?v=3","gravatar_id":"","url":"https://api.github.com/users/geoffp","html_url":"https://github.com/geoffp","followers_url":"https://api.github.com/users/geoffp/followers","following_url":"https://api.github.com/users/geoffp/following{/other_user}","gists_url":"https://api.github.com/users/geoffp/gists{/gist_id}","starred_url":"https://api.github.com/users/geoffp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoffp/subscriptions","organizations_url":"https://api.github.com/users/geoffp/orgs","repos_url":"https://api.github.com/users/geoffp/repos","events_url":"https://api.github.com/users/geoffp/events{/privacy}","received_events_url":"https://api.github.com/users/geoffp/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T20:48:22Z","updated_at":"2015-12-09T20:48:22Z","body":"So, okay, this all makes sense. I'm super on board with @dmolsen's decoupled component architecture. There has to at least be a way to upgrade or swap out the moving parts without disturbing your actual library of patterns. Even though this complicates the architecture, I think Salem and Dave are right that NPM can make it pretty easy.\r\n\r\nIn the present-day monolithic world, my approach has been to include all supported engines, but only enable the ones whose renderer is installed by the end user. Even in that architecture, if we want to deliver easy-peasy starter kits like PL/Node+Handlebars or whatever, in the short term, it's just a matter of packaging and what's in the package.json by default.\r\n\r\nBut if pattern engines were factored out into their own npm packages, dependencies would come along for free. And no matter what starter kit you use, you can always just install another engine if you need a mixed tree. That seems cleaner.\r\n\r\nAs we were talking about splitting all these parts into npm modules, I started to get anxious about the awkwardness of git workflow when working on an npm module in-place, but I found [npm link](https://docs.npmjs.com/cli/link) and now I think I feel better."}}