Sage 10 with Acorn + WP Engine

Posting a solution for making Sage 10 + Acorn work with WP Engine managed hosting. It looks like there is a future proof solution in the works here however the solution below works as expected.

// functions.php

| Fix Sage 10 to work with WP Engine environments
| Override Acorn's view cache path to /tmp/sage-cache if the site
| is running on WP Engine environment.
| /tmp/sage-cache/framework/cache path should be present in WP Engine
| for Sage 10 to work. You can ask WP Engine support to create this path on new
| install if not present and make it writable.
| This is required for Sage 10 to work on WP Engine as the default
| view cache path is /<YourWordPressInstallRoot>/wp-content/cache/acorn/framework/views
| and with that default path, WP Engine doesn't allow PHP user to execute/write files in 
| that directory.
| filter ref:
| is_wpe ref:

add_filter('acorn/', function ($path) {
    if (function_exists('is_wpe') && is_wpe() == 1) {
        return '/tmp/sage-cache';

    return $path;