**Steam** is the rendering component in Locomotive based on the Rack middleware architecture (http://rack.github.io). It's shipped with both Wagon and Locomotive Engine.

Each Locomotive "functionality" can be represented as a rack middleware piled up in a stack. For instance, detecting the locale from a request is a single rack middleware.

So, enhancing the rendering component is a matter of adding a new middleware at the right position in the stack.

In order to achieve that, you need to create a gem which will have to be installed in both your Wagon site and your Locomotive rails application.

For Locomotive.works customers:

If you need to tweak the Locomotive rendering for your site, please contact us (contact at locomotivecms dot com).

## The middleware stack in Wagon

Here is the current Steam stack when serving a site with Wagon:

  • Rack::Rewrite

  • Locomotive::Steam::Middlewares::Favicon

  • Rack::Static

  • Locomotive::Steam::Middlewares::DynamicAssets

  • Dragonfly::Middleware

  • Rack::LiveReload

  • Locomotive::Wagon::Middlewares::ErrorPage

  • Rack::Lint

  • Rack::Session::Moneta

  • Locomotive::Steam::Middlewares::DefaultEnv

  • Locomotive::Steam::Middlewares::Site

  • Locomotive::Steam::Middlewares::Logging

  • Locomotive::Steam::Middlewares::UrlRedirection

  • Locomotive::Steam::Middlewares::Robots

  • Locomotive::Steam::Middlewares::Timezone

  • Locomotive::Steam::Middlewares::EntrySubmission

  • Locomotive::Steam::Middlewares::Locale

  • Locomotive::Steam::Middlewares::LocaleRedirection

  • Locomotive::Steam::Middlewares::PrivateAccess

  • Locomotive::Steam::Middlewares::Path

  • Locomotive::Steam::Middlewares::Page

  • Locomotive::Steam::Middlewares::Sitemap

  • Locomotive::Steam::Middlewares::TemplatizedPage

## 1. Initialize your gem

## 2. Make custom Liquid drops available in your page

That's one of the enhancements you can make with the gem we're building.

Basically, we need to:

  • create a middleware to reference our drop(s)

  • In the middleware, we will enhance the **env[‘steam.liquid_assigns’]** of Steam

## 3. Register the middleware

## 4. Use it in Wagon and Engine

Please test your code!

An example how to do it here: https://github.com/did/locomotive_view_counter

In the Gemfile of your **Wagon** site:

In the Gemfile of your **Locomotive** Rails app

## Result

So now, in any of our liquid pages in Wagon, we have access to the products liquid drop.