3 ms·
After deep-diving on front-end stuff in the late 2000s, I got enamored with the idea of a templating engine that would let you address content into places in th
by wwweston 5y ago
After deep-diving on front-end stuff in the late 2000s, I got enamored with the idea of a templating engine that would let you address content into places in the document rather than strain it in via placeholders.
Eventually, I wrote a library for it in PHP [0] and built a blog and another app or two around it. Never could seem to sell many people on the basic concept, though. Glad to see someone else had some similar ideas.
[0] http://weston.canncentral.org/web_lab/CAST/about.html http://weston.canncentral.org/web_lab/CAST/about.html
https://github.com/westonc/CAST/ https://github.com/westonc/CAST/
- pattyj 5y agohttps://github.com/Level-2/Transphporm https://github.com/Level-2/Transphporm is the same idea with more selectors and caching
- wwweston 5y agoNice! Also seems to be written in more recent php versions/idioms.
- abathur 5y agoInteresting to see this and the gp--especially how others are thinking/communicating about them. I have been picking at something that uses css in a similar way, but I've found it difficult to put what it is into words.
- danellis 5y agoSeparation of concerns. The person writing the HTML should get to decide where the data is rendered in the page, not the person generating the data. What you've done (as far as I can tell) is unnecessarily couple the backend to the structure of the presentation layer.
- wwweston 5y agoSomeone doing all the content addressing within PHP would indeed be coupling the backend, and while I can imagine that being conditionally useful you're probably right that it would have drawbacks as a general pattern. Someone using the Content Addressing Sheets feature of CAST would actually be adding an additional layer of separation: * HTML - document structure with decorating attributes/semantics * Content Addressing Sheet - determines where in the document computed content is displayed * Domain Logic - determines values to be computed The CAS is a CSS-like DSL that is very much not the backend host language (though it may invoke things defined within that language). Will the same person author the HTML and CAS? Not necessarily, but it's certainly as plausible as someone authoring an HTML file with template syntax sprinkled around.