Processing new file types -- where to begin?

tl;dr: where should I look or latch in to process new file types during a build?

I’ve recently discovered middleman which also means I’ve just been introduced to Ruby and this entire new ecosystem, so please have patience on a newbie.

I’m using middleman to build a help system that has multiple targets. In order to simply get my build system for the help files working, I’ve implemented it all with a Ruby script that executes “build middleman” directly, and then processes my “new file types” in the Ruby script.

Now that it’s working and the help system is complete, the obsessive-compulsive part of my wants to go back and re-engineer this so I can do it “the middleman way” (and it’ll help with my Ruby growth, too).

In this case I’m processing *.plist files, which fundamentally simple XML files.

I know that middleman uses Rack (and I’ve read some background on it), and middleman uses Sprockets (which apparently also uses Rack).

In the middleman sample page for Rack it looks like every file is run through a filter… is there a nice middleman way to only run *.plist files through it? It looks like building the actual Rack processor will be simple enough.

Or is a more natural (middleman-like) way to build a new engine for Sprockets? The middleman Sprockets page is heavily geared towards css and js.

I think I’m looking more for middleman infrastructure or system-integration tips rather than actual code.

Thanks!

What kind of files are you trying to produce? Html pages?

I often find it practical to use after_build to manipulate files that Middleman (i.e. the templating engine Tilt) does not handle. The drawback is that you will not see the result until after you’ve built your site.

Thanks, this is the approach that I took after all, i.e., using after_build in a new class. This actually had a whole lot of benefits and made my help-building system really pretty cool, probably doing things that Middleman wasn’t intended for.