phlexing icon indicating copy to clipboard operation
phlexing copied to clipboard

HAML to Phlex, Slim to Phlex

Open bb opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. In some Projects, I use HAML or Slim templates. It would be great if I could convert snippets from there to Phlex in one simple step.

Describe the solution you'd like When pasting/typing into the ERB field, it would be nice to auto-detect the input format (ERB or HAML or Slim) and do the transformation to Phlex. Instead of auto-detect, it could be aided by a format select box providing the available values.

One could try going directly from HAML to Phlex using e.g. https://github.com/LukeClancy/haml2phlex or from HAML to ERB e.g. using https://github.com/elia/haml2erb and then use the existing approach for ERB to Phlex. Another option might be integrating Tilt and changing its evaluation from executing to outputting the Ruby code.

bb avatar Sep 13 '24 08:09 bb

Hey @bb, thanks for opening this issue!

Do you want to spike this idea to see where it could go? I think I'd personally prefer the haml2erb way as a "pre-step" so we can leverage the whole remaining logic phlexing has around custom elements, Rails helpers, component names, method extraction etc.

marcoroth avatar Sep 13 '24 09:09 marcoroth

Hi @marcoroth,

thanks for the guidance regarding the pre-step. I already considered doing a spike but also wanted to post the request here to gauge interest, get recommendations like yours and of course because I'm lazy 😜.

I'll give it a shot, but if anybody wants to take this, please go ahead.

bb avatar Sep 13 '24 10:09 bb