Skip to content

Instantly share code, notes, and snippets.

@cgrand cgrand/
Last active Dec 22, 2015

What would you like to do?

You can use id attributes suffixed by # within your HTML template code in order to generate :#id# selectors that you can later use within Enlive template.

For example, if you say:

<div id="content-main#"></div>

You can later reference it with :#content-main# selector, which will be automatically generated for you.

One of the hidden benefist is that if your application code relies on some element in HTML, here it will be validated, and if there's anything referenced that's not present in HTML, you'll get a warning during compilation.

Such ids are automatically removed so duplicate ids won't show up in the output.


This comment has been minimized.

Copy link

ifesdjeen commented Sep 9, 2013

2 points:

  • I thought of something that would be completely unobtrusive with standard
  • If id# generates a symbol, you don't have to validate it again, and you'll get errors during compile time vs execution time (e.g. selector can't be matched)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.