bridgetownrb / bridgetown

A next-generation progressive site generator & fullstack framework, powered by Ruby
https://www.bridgetownrb.com
MIT License
1.13k stars 114 forks source link

feat: Phlex template support via bundled configuration #729

Closed jaredcwhite closed 7 months ago

jaredcwhite commented 1 year ago

Update: see https://github.com/bridgetownrb/bridgetown/issues/729#issuecomment-1470248232 (we'll keep the main support out of core but still offer the CLI option)


Phlex is a really awesome new "Ruby DSL" template format which lets you output HTML and other markup right from pure Ruby code.

I've been finding it helpful enough on various projects that I think we should offer first-party support for it in Bridgetown, and since the Lifeform gem also uses Phlex and I expect Lifeform to get used a lot on various sites in future once it's fully baked, it seems like a no-brainer.

I have some demo code already to use Phlex in components and even within a pure Ruby page template/layout, so I just need to extract that out into a PR that we can play around with here.

Needless to say, it should be a viable option for new site builds, aka bridgetown new mysite -t phlex (which would actually set the "default" template handler to ERB for things like Markdown but then offer Phlex components and view helpers)

ayushn21 commented 1 year ago

I think Phlex is great, but I'd be reluctant to include it in core. It's still a new-ish project (relatively speaking) and I see it's usage very much as a personal preference thing. I doubt I'd reach for it in Bridgetown too often.

I definitely think we should offer first-party support for it, but I'm in favour of a first-party plugin rather than including it in core. I just don't want core to expand too big and try to do too much.

jaredcwhite commented 1 year ago

@ayushn21 Ah, the voice of reason!

I was originally thinking of it being a separate plugin… my only question though is how to get the new site template working, if someone wants to start using Phlex. Maybe the -t flag could just trigger a bundled configuration that installs the gem and components?

ayushn21 commented 1 year ago

Yup I think a bundle configuration is the way to go! .... we could absolutely give it some "special treatment" in the CLI rather than going through the usual -c flag since it's a first party plugin.

jaredcwhite commented 7 months ago

I'm not really working with Phlex these days, and we have a replacement of sorts for this in the form of string-based procs (see #817, so just going to close the issue.