deface icon indicating copy to clipboard operation
deface copied to clipboard

Request: allow multiple overrides per .deface file

Open dacook opened this issue 11 years ago • 1 comments

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.

dacook avatar Sep 18 '13 02:09 dacook

To respond to the two problems I mentioned, these might be possible solutions:

  1. 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
  2. What name should subsequent overrides have?
    • Maybe simply append a sequence number to the name for the second, third, fourth, etc overrides.

dacook avatar Sep 18 '13 03:09 dacook