TL;DR: We deleted 310 lines of template middleware by switching to native Accord Project TemplateMark grammar. Zero regressions.
The Problem
Our legal agreement templates needed to render in the browser. We had a translation layer converting TemplateMark grammar into an intermediate format — 310 lines of middleware that existed for no good reason.
The Approach
TemplateMark already has a formal grammar. We were translating to an intermediate format unnecessarily.
// Before: translate TemplateMark -> intermediate -> render
const intermediate = translateTemplate(templateMark);
const html = renderIntermediate(intermediate);
// After: render TemplateMark directly
const html = renderTemplateMark(templateMark);
Result
- 310 lines deleted
- Zero regressions across 6 agreement types
- Simpler mental model for contributors
Builder's Note
Spent most of the day convinced the tests would break. They didn't. Sometimes the best code you write is the code you delete.
Top comments (0)