-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Proof of concept "Liquidbook" — first implementation of Liquid Components #26
Conversation
begin | ||
content = ::File.read(filename) | ||
file_content = $POSTMATCH if content =~ Document::YAML_FRONT_MATTER_REGEXP | ||
rescue Psych::SyntaxError => e |
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 just realized we don't need this since we're not actually parsing the YAML, just stripping it out :)
TODO: I'm now thinking virtually all of this needs to be in separate gem(s). Bridgetown can reference (some of) them as default dependencies of course, but it's really not Bridgetown's responsibility to deal with the low-level machinations of how Liquid Components work. |
f193274
to
d2a94a0
Compare
OK, this is looking pretty good now. It's using the new Liquid Component gem to parse components, and the preview logic got refactored into a concise builder plugin. At some point down the road it'll be cool to extract the component previews into its own gem-based plugin, but for this initial pass I think keeping it in the website repo as a demo will be fine. |
Haha, it might help if I actually pushed up the commit 🤣 |
All right, |
Merged into the 0.15 beta release branch. |
In a first "proof of concept" pass at implementing the Liquid Components spec, this PR allows YAML front matter to live at the top of Liquid templates for use with the
render
tag. For example:Our implementation of the Liquid File System which finds and loads in templates will automatically detect and strip out YAML front matter and provide just the actual template code to the Liquid parser.
Doing something extra with that front matter isn't currently a feature of Bridgetown Core. However, the public website now has a custom plugin and set of templates and other logic to build up a "Liquidbook" UI (aka Storybook for Liquid Components) to list out and preview components. It's available via this PR at
/components
. At some point in the future I imagine it'll make sense to extract a bunch of this out into its own project/gem for others to use, but this is just the initial proof of concept.Check it out in the deploy preview!
https://deploy-preview-26--bridgetownrb.netlify.app/components/