-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Twig PHP Engine in Pattern Lab node #897
Conversation
Tried to install, but getting the same error as Travis:
|
🤔 hmmm... @bmuenzenmeyer - any ideas on above error? |
@EvanLovely will take a look, first glance doesn't ring any bells for me |
Fixed this - originally fixed in 5ab3995 after some research into lock-file behavior with lerna bootstraps being unreliable. Since we pin all dependencies, we should still have deterministic installations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 📢 ⚡️ 💣 💥
This is a pretty significant accomplishment in the history of Pattern Lab. Great work Evan! It's the culmination of so many discussions and technical hops.
.travis.yml
Outdated
@@ -1,6 +1,7 @@ | |||
language: node_js | |||
|
|||
before_install: | |||
- npm i -g npm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like doing this - as npm has been known to break itself even with minor or patch releases. Since the .travis.yml file should be supplying Node versions, it also reliably gets the npm version bundled with Node
I think this was added as a troubleshooting step. If so, please remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, another PL Node newb question here: any particular reason why aren’t we using Yarn + Lerna Workspaces here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We focused on Lerna for our initial monorepo conversion. I don't want to get into the game of documenting everything with npm and yarn. npm 5+ has come a long way., blunting the original benefits of yarn to me. We do not use lockfiles (as you can see the problems in this PR) anyways, further blunting the need. I understand we could use yarn for dev and posture to users only npm, but I don't really understand the need for yet another tool. Please let me know if I am missing something here 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Less tools is better IMO :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was done as a troubleshooting step; removed now.
package.json
Outdated
@@ -3,7 +3,7 @@ | |||
"lerna": "3.0.0-beta.21" | |||
}, | |||
"scripts": { | |||
"bootstrap": "lerna bootstrap --hoist tap --hoist eslin* --hoist husky --hoist prettier --hoist pretty-quick", | |||
"bootstrap": "lerna bootstrap --no-ci --hoist tap --hoist eslin* --hoist husky --hoist prettier --hoist pretty-quick", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do? I cannot find this flag on https://github.com/lerna/lerna
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn’t we move these to the lerna.json config in the root so these flags always get added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be fine with moving it there in case someone has lerna installed globally and instead runs lerna bootstrap
It sounds like you might have more experience with lerna, could you offer up a focused PR to do this @sghoweri ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely - happy to help! 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The --no-ci
flag is part of v3, those docs are v2. https://github.com/lerna/lerna/tree/v3.0.0-beta.21#--ci
When I bumped npm from 5 to 6, lerna uses npm ci
instead of npm install
, and I had error messages surrounding it. Since I removed the Travis npm update, I also removed this tweak.
@@ -0,0 +1 @@ | |||
{"version":1,"timestamp":1531799832072,"graph":{"options":{"directed":true,"multigraph":false,"compound":false},"nodes":[{"v":"03-templates/01-homepage.twig","value":{"compileState":"clean"}},{"v":"03-templates/02-blog.twig","value":{"compileState":"clean"}},{"v":"03-templates/03-article-2col.twig","value":{"compileState":"clean"}},{"v":"03-templates/03-article.twig","value":{"compileState":"clean"}},{"v":"04-pages/00-homepage.twig","value":{"compileState":"clean"}},{"v":"04-pages/01-blog.twig","value":{"compileState":"clean"}},{"v":"04-pages/02-article.twig","value":{"compileState":"clean"}},{"v":"00-atoms/01-global/00-colors.twig","value":{"compileState":"clean"}},{"v":"00-atoms/01-global/01-fonts.twig","value":{"compileState":"clean"}},{"v":"00-atoms/01-global/02-animations.twig","value":{"compileState":"clean"}},{"v":"00-atoms/01-global/03-visibility.twig","value":{"compileState":"clean"}},{"v":"00-atoms/03-lists/00-unordered.twig","value":{"compileState":"clean"}},{"v":"00-atoms/03-lists/01-ordered.twig","value":{"compileState":"clean"}},{"v":"00-atoms/03-lists/02-definition.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/00-headings.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/02-blockquote.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/01-paragraph.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/03-inline-elements.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/04-time.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/05-preformatted-text.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/06-hr.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/00-logo.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/01-landscape-4x3.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/02-landscape-16x9.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/03-square.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/04-avatar.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/05-icons.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/06-loading-icon.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/07-favicon.twig","value":{"compileState":"clean"}},{"v":"00-atoms/05-forms/00-text-fields.twig","value":{"compileState":"clean"}},{"v":"00-atoms/05-forms/01-select-menu.twig","value":{"compileState":"clean"}},{"v":"00-atoms/05-forms/02-checkbox.twig","value":{"compileState":"clean"}},{"v":"00-atoms/05-forms/03-radio-buttons.twig","value":{"compileState":"clean"}},{"v":"00-atoms/05-forms/04-html5-inputs.twig","value":{"compileState":"clean"}},{"v":"00-atoms/06-buttons/00-buttons.twig","value":{"compileState":"clean"}},{"v":"00-atoms/07-tables/00-table.twig","value":{"compileState":"clean"}},{"v":"00-atoms/08-media/_00-video.twig","value":{"compileState":"clean"}},{"v":"00-atoms/08-media/_01-audio.twig","value":{"compileState":"clean"}},{"v":"01-molecules/00-text/00-byline.twig","value":{"compileState":"clean"}},{"v":"01-molecules/00-text/01-address.twig","value":{"compileState":"clean"}},{"v":"01-molecules/00-text/02-heading-group.twig","value":{"compileState":"clean"}},{"v":"01-molecules/00-text/03-blockquote-with-citation.twig","value":{"compileState":"clean"}},{"v":"01-molecules/00-text/04-intro-text.twig","value":{"compileState":"clean"}},{"v":"01-molecules/01-layout/01-two-up.twig","value":{"compileState":"clean"}},{"v":"01-molecules/01-layout/00-one-up.twig","value":{"compileState":"clean"}},{"v":"01-molecules/01-layout/02-three-up.twig","value":{"compileState":"clean"}},{"v":"01-molecules/01-layout/03-four-up.twig","value":{"compileState":"clean"}},{"v":"01-molecules/02-blocks/00-media-block.twig","value":{"compileState":"clean"}},{"v":"01-molecules/02-blocks/01-block-headline-byline.twig","value":{"compileState":"clean"}},{"v":"01-molecules/02-blocks/02-block-hero.twig","value":{"compileState":"clean"}},{"v":"01-molecules/02-blocks/03-block-thumb-headline.twig","value":{"compileState":"clean"}},{"v":"01-molecules/02-blocks/04-block-headline.twig","value":{"compileState":"clean"}},{"v":"01-molecules/02-blocks/05-block-inset.twig","value":{"compileState":"clean"}},{"v":"01-molecules/03-media/00-figure-with-caption.twig","value":{"compileState":"clean"}},{"v":"01-molecules/04-forms/01-comment-form.twig","value":{"compileState":"clean"}},{"v":"01-molecules/04-forms/00-search.twig","value":{"compileState":"clean"}},{"v":"01-molecules/04-forms/02-newsletter.twig","value":{"compileState":"clean"}},{"v":"01-molecules/05-navigation/01-footer-nav.twig","value":{"compileState":"clean"}},{"v":"01-molecules/05-navigation/00-primary-nav.twig","value":{"compileState":"clean"}},{"v":"01-molecules/05-navigation/02-breadcrumbs.twig","value":{"compileState":"clean"}},{"v":"01-molecules/05-navigation/03-pagination.twig","value":{"compileState":"clean"}},{"v":"01-molecules/05-navigation/04-tabs.twig","value":{"compileState":"clean"}},{"v":"01-molecules/06-components/00-social-share.twig","value":{"compileState":"clean"}},{"v":"01-molecules/06-components/01-accordion.twig","value":{"compileState":"clean"}},{"v":"01-molecules/06-components/02-single-comment.twig","value":{"compileState":"clean"}},{"v":"01-molecules/07-messaging/00-alert.twig","value":{"compileState":"clean"}},{"v":"02-organisms/00-global/00-header.twig","value":{"compileState":"clean"}},{"v":"02-organisms/00-global/01-footer.twig","value":{"compileState":"clean"}},{"v":"02-organisms/01-article/00-article-body.twig","value":{"compileState":"clean"}},{"v":"02-organisms/02-comments/00-comment-thread.twig","value":{"compileState":"clean"}},{"v":"02-organisms/03-sections/00-latest-posts.twig","value":{"compileState":"clean"}},{"v":"02-organisms/03-sections/01-recent-tweets.twig","value":{"compileState":"clean"}},{"v":"02-organisms/03-sections/02-related-posts.twig","value":{"compileState":"clean"}},{"v":"03-templates/00-layouts/00-site.twig","value":{"compileState":"clean"}},{"v":"03-templates/00-layouts/01-page-1col.twig","value":{"compileState":"clean"}},{"v":"03-templates/00-layouts/01-page-2col.twig","value":{"compileState":"clean"}},{"v":"04-pages/00-homepage~emergency.json","value":{"compileState":"clean"}}],"edges":[{"v":"04-pages/00-homepage~emergency.json","w":"04-pages/00-homepage.twig","value":{}}]}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is an artifact of sorts and should not be initially available as part of generation. It should not be ignored either,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can’t this be gitgnored?... Directly committing auto generated assets = 😰
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's think through this outloud - perhaps it could be? or perhaps not? My current thinking is that teams would want to check this in along with changes - so that another dev pulls down the changes and can run PL with incremental builds on - allowing PL to only build what's changed. If this is gitignored, users pulling down changes will have incorrect dependencyGraphs upon build, leading to odd behavior. Perhaps we need more testing around how this works for teams.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not following @bmuenzenmeyer 's logic. We work with usually 2 devs here doing Patternlab. 99% of the time we are editing patterns, assets, or corresponding json. If one of the devs pushes changes, we just pull and then start where they left off. I don't see how this autogenerated file would help.
My $0.02 -- If they push changes, this file would autogenerate regardless because I'd have to run PL regardless. I don't see a case for pushing this file so that someone could investigate this file and see the state that everything is in.
In fact, if someone really wanted to see this, they could edit their own .gitignore to allow it.
That's my $0.02, not sure if I'm helping or not here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the person who implemented that feature:
This file caches the current build status of each pattern, so if either the data or the meta data changes after the last build, the file gets recompiled incrementally with all descendant patterns.
It can be regarded as a local build cache and thus should be added to .gitignore.
The alternative would be hell:
Version patterns, data and the generated output files with correct modification timestamps. This would lead to lots of potential merge conflicts in the dependency graph file when a few developers collaboratem, so
don't do this, ever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a case for pushing this file so that someone could investigate this file and see the state that everything is in.
Worth noting that no one would really look at this file manually.
It can be regarded as a local build cache and thus should be added to .gitignore.
thanks for chiming in! ignore it is then
packages/edition-twig/package.json
Outdated
"@pattern-lab/engine-mustache": "^2.0.0-alpha.6", | ||
"@pattern-lab/engine-twig-php": "^0.1.0", | ||
"@pattern-lab/uikit-workshop": "^1.0.0-alpha.5", | ||
"@pattern-lab/starterkit-twig-demo": "^4.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you intend the Twig edition to contain the demo? This leads to a ton of duplicate code compared to starterkit-twig-demo
. It's just a departure from the other editions, which have always been empty with the expectations that users install the starterkits separately.
Truer still, the CLI will now ask for the edition and then the starterkit, so baking them both into the edition reduces the value of the CLI process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR would be a ton smaller without all these files from the starterkit, too.
"version": "0.1.0", | ||
"main": "lib/engine_twig_php.js", | ||
"dependencies": { | ||
"@basalt/twig-renderer": "^0.7.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we pin these dependencies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1 @@ | |||
{"version":1,"timestamp":1531799832072,"graph":{"options":{"directed":true,"multigraph":false,"compound":false},"nodes":[{"v":"03-templates/01-homepage.twig","value":{"compileState":"clean"}},{"v":"03-templates/02-blog.twig","value":{"compileState":"clean"}},{"v":"03-templates/03-article-2col.twig","value":{"compileState":"clean"}},{"v":"03-templates/03-article.twig","value":{"compileState":"clean"}},{"v":"04-pages/00-homepage.twig","value":{"compileState":"clean"}},{"v":"04-pages/01-blog.twig","value":{"compileState":"clean"}},{"v":"04-pages/02-article.twig","value":{"compileState":"clean"}},{"v":"00-atoms/01-global/00-colors.twig","value":{"compileState":"clean"}},{"v":"00-atoms/01-global/01-fonts.twig","value":{"compileState":"clean"}},{"v":"00-atoms/01-global/02-animations.twig","value":{"compileState":"clean"}},{"v":"00-atoms/01-global/03-visibility.twig","value":{"compileState":"clean"}},{"v":"00-atoms/03-lists/00-unordered.twig","value":{"compileState":"clean"}},{"v":"00-atoms/03-lists/01-ordered.twig","value":{"compileState":"clean"}},{"v":"00-atoms/03-lists/02-definition.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/00-headings.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/02-blockquote.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/01-paragraph.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/03-inline-elements.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/04-time.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/05-preformatted-text.twig","value":{"compileState":"clean"}},{"v":"00-atoms/02-text/06-hr.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/00-logo.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/01-landscape-4x3.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/02-landscape-16x9.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/03-square.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/04-avatar.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/05-icons.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/06-loading-icon.twig","value":{"compileState":"clean"}},{"v":"00-atoms/04-images/07-favicon.twig","value":{"compileState":"clean"}},{"v":"00-atoms/05-forms/00-text-fields.twig","value":{"compileState":"clean"}},{"v":"00-atoms/05-forms/01-select-menu.twig","value":{"compileState":"clean"}},{"v":"00-atoms/05-forms/02-checkbox.twig","value":{"compileState":"clean"}},{"v":"00-atoms/05-forms/03-radio-buttons.twig","value":{"compileState":"clean"}},{"v":"00-atoms/05-forms/04-html5-inputs.twig","value":{"compileState":"clean"}},{"v":"00-atoms/06-buttons/00-buttons.twig","value":{"compileState":"clean"}},{"v":"00-atoms/07-tables/00-table.twig","value":{"compileState":"clean"}},{"v":"00-atoms/08-media/_00-video.twig","value":{"compileState":"clean"}},{"v":"00-atoms/08-media/_01-audio.twig","value":{"compileState":"clean"}},{"v":"01-molecules/00-text/00-byline.twig","value":{"compileState":"clean"}},{"v":"01-molecules/00-text/01-address.twig","value":{"compileState":"clean"}},{"v":"01-molecules/00-text/02-heading-group.twig","value":{"compileState":"clean"}},{"v":"01-molecules/00-text/03-blockquote-with-citation.twig","value":{"compileState":"clean"}},{"v":"01-molecules/00-text/04-intro-text.twig","value":{"compileState":"clean"}},{"v":"01-molecules/01-layout/01-two-up.twig","value":{"compileState":"clean"}},{"v":"01-molecules/01-layout/00-one-up.twig","value":{"compileState":"clean"}},{"v":"01-molecules/01-layout/02-three-up.twig","value":{"compileState":"clean"}},{"v":"01-molecules/01-layout/03-four-up.twig","value":{"compileState":"clean"}},{"v":"01-molecules/02-blocks/00-media-block.twig","value":{"compileState":"clean"}},{"v":"01-molecules/02-blocks/01-block-headline-byline.twig","value":{"compileState":"clean"}},{"v":"01-molecules/02-blocks/02-block-hero.twig","value":{"compileState":"clean"}},{"v":"01-molecules/02-blocks/03-block-thumb-headline.twig","value":{"compileState":"clean"}},{"v":"01-molecules/02-blocks/04-block-headline.twig","value":{"compileState":"clean"}},{"v":"01-molecules/02-blocks/05-block-inset.twig","value":{"compileState":"clean"}},{"v":"01-molecules/03-media/00-figure-with-caption.twig","value":{"compileState":"clean"}},{"v":"01-molecules/04-forms/01-comment-form.twig","value":{"compileState":"clean"}},{"v":"01-molecules/04-forms/00-search.twig","value":{"compileState":"clean"}},{"v":"01-molecules/04-forms/02-newsletter.twig","value":{"compileState":"clean"}},{"v":"01-molecules/05-navigation/01-footer-nav.twig","value":{"compileState":"clean"}},{"v":"01-molecules/05-navigation/00-primary-nav.twig","value":{"compileState":"clean"}},{"v":"01-molecules/05-navigation/02-breadcrumbs.twig","value":{"compileState":"clean"}},{"v":"01-molecules/05-navigation/03-pagination.twig","value":{"compileState":"clean"}},{"v":"01-molecules/05-navigation/04-tabs.twig","value":{"compileState":"clean"}},{"v":"01-molecules/06-components/00-social-share.twig","value":{"compileState":"clean"}},{"v":"01-molecules/06-components/01-accordion.twig","value":{"compileState":"clean"}},{"v":"01-molecules/06-components/02-single-comment.twig","value":{"compileState":"clean"}},{"v":"01-molecules/07-messaging/00-alert.twig","value":{"compileState":"clean"}},{"v":"02-organisms/00-global/00-header.twig","value":{"compileState":"clean"}},{"v":"02-organisms/00-global/01-footer.twig","value":{"compileState":"clean"}},{"v":"02-organisms/01-article/00-article-body.twig","value":{"compileState":"clean"}},{"v":"02-organisms/02-comments/00-comment-thread.twig","value":{"compileState":"clean"}},{"v":"02-organisms/03-sections/00-latest-posts.twig","value":{"compileState":"clean"}},{"v":"02-organisms/03-sections/01-recent-tweets.twig","value":{"compileState":"clean"}},{"v":"02-organisms/03-sections/02-related-posts.twig","value":{"compileState":"clean"}},{"v":"03-templates/00-layouts/00-site.twig","value":{"compileState":"clean"}},{"v":"03-templates/00-layouts/01-page-1col.twig","value":{"compileState":"clean"}},{"v":"03-templates/00-layouts/01-page-2col.twig","value":{"compileState":"clean"}},{"v":"04-pages/00-homepage~emergency.json","value":{"compileState":"clean"}}],"edges":[{"v":"04-pages/00-homepage~emergency.json","w":"04-pages/00-homepage.twig","value":{}}]}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can’t this be gitgnored?... Directly committing auto generated assets = 😰
.travis.yml
Outdated
@@ -1,6 +1,7 @@ | |||
language: node_js | |||
|
|||
before_install: | |||
- npm i -g npm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, another PL Node newb question here: any particular reason why aren’t we using Yarn + Lerna Workspaces here?
package.json
Outdated
@@ -3,7 +3,7 @@ | |||
"lerna": "3.0.0-beta.21" | |||
}, | |||
"scripts": { | |||
"bootstrap": "lerna bootstrap --hoist tap --hoist eslin* --hoist husky --hoist prettier --hoist pretty-quick", | |||
"bootstrap": "lerna bootstrap --no-ci --hoist tap --hoist eslin* --hoist husky --hoist prettier --hoist pretty-quick", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn’t we move these to the lerna.json config in the root so these flags always get added?
{ | ||
"engines": { | ||
"twig": { | ||
"namespaces": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EvanLovely three big questions here:
- Are these recursive by default?
- How do we configure PHP Twig extensions?
- For that matter, how would we configure any of the other Twig Renderer config options:
https://github.com/basaltinc/twig-renderer/blob/master/config.schema.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Not by default, but that's just a
recursive: true
away. I want to update the Twig StarterKit demo to change things like@atoms/04-folder/01-item.twig
to@atoms/01-item.twig
as well. - Just set
engines.twig.alterTwigEnv
- you can see where the config is passed in here - I want to review the config a bit more on TwigRenderer before I lock it down (and release 1.0.0). Then we just pass more config in like the above link.
"meta": "./source/_meta/", | ||
"annotations": "./source/_annotations/", | ||
"styleguide": "dist/", | ||
"patternlabFiles": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EvanLovely woah woah woah - hold up! I’m like 99% sure we need to swap these out with out verbatim with the Twig versions of these (and add this to the monorepo here):
I already went ahead and ported these original Twig Templates over/ updated to work with the latest CSS / JS changes in the UIKit Workshop if this helps:
https://github.com/bolt-design-system/bolt/tree/master/packages/styleguidekit-twig-default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's working right now as this supports rendering Twig and Mustache files. I'm fine with getting Twig ones in there as well.
I did a light test of this. It seems initially to work great. |
OK, all crucial feedback from above has been addressed. There's one semi-major thing left to consider: Twig Namespaces & Starterkits. Since we don't automagically figure out where the As this PR currently stands, the {
"engines": {
"twig": {
"namespaces": [
{
"id": "atoms",
"paths": [
"source/_patterns/00-atoms"
]
},
{
"id": "molecules",
"paths": [
"source/_patterns/01-molecules"
]
},
// more namespace config...
]
}
},
"cacheBust": true,
// more pl config...
} And so if the It seems to me that a Twig Starterkit should come with some config for Namespaces and that's where this config should live, not |
I've always used Twig namespaces as a library mechanism in previous projects: To me you'd want to configure namespaces in a central location where it's easy to require uniqueness. |
@EvanLovely anything I can do to help with this one? What’s the next step here? |
Got this all working!! |
…lab/patternlab-node into feature/engine-twig-php
…ernlab-node into feature/engine-twig-php
…lab/patternlab-node into feature/engine-twig-php
…renderer work getting merged in
…ring PL to get the Twig renderer back up and running
Main issues addressed. Should be stable enough to merge down to dev and iterate if needed.
Released as It's basically the difference between this: ../uikit-workshop/views-twig and this: node_modules/@pattern-lab/uikit-workshop/views-twig That's all I needed to change and then it worked! Any thoughts on how to fix it? Allowing config files to be |
Thanks @EvanLovely!! I’d be happy to tackle this one — can’t imagine this’ll be super tricky. |
…ig-php Twig PHP Engine in Pattern Lab node
🎉 OK, here we go! This adds a Twig PHP Engine and implements it in the Twig Edition. This is really sweet because this will let us Unify Pattern Lab Core by bringing the most essential part of the PHP Pattern Lab world in: a real Twig environment using the actual engine.
I'll have to get into more later, but I've created
@basalt/twig-renderer
which is a JS module that takes config and gives back a render JS function that when called spins up an internal PHP server that exposes an API endpoint that renders Twig templates. It's all async and it can render 1,000 simple Twig templates in about 5s - and only spins up 1 PHP server for that @aleksip 😉Take a peak @pattern-lab/devs and tell me what you think!
To test:
npm install npm run bootstrap cd packages/edition-twig npm start
Bugs to fix:
_meta
patterns not rendering on individual pattern page (but do on view all pages)