Shopify/packwerk

Support parsing slim (or temple?) template files

oboxodo opened this issue ยท 7 comments

It'd be nice to be able to include slim files, just like erb files are supported. Slim is actually built on top of Temple which is a generic templates parser/compiler. Maybe it would even be worth it to replace the existing erb parser with a temple parse as it includes erb built-in and you'd be getting support for many others all at once.

I don't know temple, but I'm pretty sure we don't want to add more parsers right now. We've actually discussed removing the erb parser.

If it can replace the existing parser, there's a chance that we'll merge it (but no promises, since the tool is very much in "maintenance only" mode from our side).

Fair enough. If you're considering removing the erb parser, then maybe you can instead extract it into a separate plugin-like gem so it can be used as a reference implementation for other potential parsers to be implemented?

We've actually discussed removing the erb parser.

I'd like to hear more about this plan/discussion. Would this mean that references to private constants from erb files would go undetected?

It's far from being decided, but Shopify has been replacing lots of erb with react frontends, so the question came up whether we should remove the erb parser. It won't happen any time soon though, and it might not happen at all (currently we still do have erb code and we want to keep analyzing that, and who knows if we'll ever completely get rid of it).

We also of course would take other user's needs into consideration.

Do I understand correctly that you're interested in continued erb support, Matt?

Do I understand correctly that you're interested in continued erb support, Matt?

Yes, for the foreseeable future at least GitHub is still using erb files and will need these constants to be detected.

Thank you for chiming in! Will keep that in mind if the topic comes up again.

Closing since we don't have any interest on adding more parsers for packwerk. We are open to receive PRs making it easier to plugin different parsers if available though.