Recently, I needed to create a downloads area that was going to be managed by a client. It’s a reasonably straight forward task, except for one snag: They wanted icons next to the links, denoting what filetype the download was. I could have created a few custom classes to add to the links, but the client is not at all technical, and I wanted to involve as little manual editing as possible.
Instead, I wrote a quick set of CSS selectors that filter the links by their href attributes, and provide the proper icon. I still provided override classes, in case it doesn’t always detect properly, but so far, it seems to be working perfectly.