Proper Filter Installation
Published 9 years, 2 months pastI ran into an interesting conceptual dilemma yesterday while I was building a test page for the filter property. In a way, it reminded me a bit of Dan Cederholm’s classic SimpleQuizzes, even though it’s not about HTML.
First, a bit of background. When I set up test suites, directories of example files, or even browser-based figures for a book, I tend to follow a pattern of having all the HTML (or, rarely, XML) files in a single directory. Inside that directory, I’ll have subdirectories containing the style sheets, images, fonts, and so on. I tend to call these c/, i/, and f/, but imagine they’re called css/, images/, and fonts/ if that helps. The names aren’t particularly important — it’s the organizational structure that matters here.
So, with that groundwork in place, here’s what happened: I wrote some SVG filters, and put them into an SVG file for referencing via the url(filters.svg#fragment) filter function pattern. So I had this SVG file that didn’t actually visually render anything; it was just a collection of filters to be applied via CSS.
I clicked-and-held the mouse button, preparing to drag the file into a subdirectory…and suddenly stopped. Where should I put it? css/, or images/? It clearly wasn’t CSS. Even if I were to rename css/ to styles/, are filter definitions really styles? I’m not sure they are. But then, what is an image that has no visual output?
(Insert “one hand clapping” reference here.)
Sure, I could set up an svg/ subdirectory, but then I’d just end up with SVG images (as in, SVGs that actually have visual output) mingled in with the filter-file… and furthermore, segregated from all the other images, the PNGs and JPGs still hanging out in images/. That seems weird.
I could establish a filters/ subdirectory, but that seems like overkill when I only planned to have a single file containing all the filters; and besides, I’m not in the habit of creating subdirectories that relate to only a single HTML file.
I could dodge the whole question by establishing a generic assets/ subdirectory, although I’ve long been of the opinion assets/, when it isn’t used to toss in all of your assets classes in their own subdirectories, is just a fancy alias for misc/. And I dislike tossing stuff into misc/, the messy kitchen junk drawer of any project.
I came to a decision in the end, but I’m not going to tell you what it was, because I’m curious: what would you do in that situation?