title: Documentation for creating custom Sprockets processors?
body: <p>I'm trying to create a sprockets preprocessor for Rails that finds <code>.png.rb</code> files in the asset pipeline and uses them to generate png screenshots of various pages in my application.</p>
  
  <p>I've read up on this topic quite a bit but I can't seem to find any straightforward documentation on how to get this set up. Help, please?</p>
  
  <p>Here's what I have so far:</p>
  
  <hr>
  
  <p><code>/initializers/sprockets.rb</code>:</p>
  
  <pre><code>require 'screenshot_preprocessor'
  
  Rails.application.assets.register_mime_type('screenshot/png', '.png.rb')
  Rails.application.assets.register_preprocessor('screenshot/png', ScreenshotPreprocessor)
  </code></pre>
  
  <hr>
  
  <p><code>/lib/screenshot_preprocessor.rb:</code></p>
  
  <pre><code>class ScreenshotPreprocessor
    # What API do I need to provide here?
    #   - What methods do I need to provide?
    #   - What parameters does Sprockets pass me?
    #   - What do I need to return to Sprockets?
  end
  </code></pre>