com-lihaoyi/scalatags

Model traversal

scf37 opened this issue · 1 comments

scf37 commented

One of strong points of scalatags is ability to traverse, extend and transform assembled model before rendering. Unfortunately it is hacky right now - not everything is public and not everything is designed to be accessed by user code.

It could be nice to cleanup scalatags model to be proper AST (but still open for extension). Use cases:

  • collect used resources and css classes before rendering
  • declare custom tags and attributes to further control rendering. For example, adding selenium anchors only when tests are requesting the page
  • transform model before rendering. I use that for CSS renaming.

Other use cases:

  • Extracting dependencies for web components and adding them to <head>.
  • Checking that needed dependencies, like css classes, exists.