deface
deface copied to clipboard
Request: allow multiple overrides per .deface file
It's possible to have multiple overrides in a Deface::Override file (as proven here: #77), but not using the new DSL in a .deface file.
I can see why it would be hard: deface actions are parsed from the first HTML comment in the file, so how to know when the next deface action starts? In other words, how to separate the individual overrides? Not to mention that the name of the override comes from the filename, so what name should the second override have?
Nevertheless having convinced myself it's probably not possible, I'd still like to have this feature. Because it would be handy for grouping several related overrides, rather than creating several new files.
For example: adding a column to a Spree Admin table, I need three overrides: th, td and colgroup.
To respond to the two problems I mentioned, these might be possible solutions:
-
How to separate individual overrides?
- The parser simply looks for relevant keywords in every comment, and if none found, just treat as normal comment.
- Or introduce a special character denoting the start of an override. Eg a pipe in HTML:
<!--| insert_top xxx -->
or HAML/| insert_top xxx
-
What name should subsequent overrides have?
- Maybe simply append a sequence number to the name for the second, third, fourth, etc overrides.