Integrating Sage 10 with Pantheon: A Step-by-Step Guide

Getting Sage 10 to work on Pantheon needs a few tweaks, but don’t worry—this guide will walk you through it step-by-step. Since Pantheon is a git based hosting solution, we need to ensure that the blade files compiled by Sage 10 and Acorn are stored outside of the repository. Let’s get started.

Step 1: Initial Setup with Acorn

First, in your theme directory, initialize Sage 10 with Acorn by running these commands:

wp acorn acorn:init
wp acorn vendor:publish --tag=acorn

These commands create a /config directory in your theme with all the necessary Acorn configuration files, which were part of Sage 9 but removed in Sage 10.

Step 2: Configuring the View Compilation Path

Next, update the config/view.php file to set the ‘compiled’ path for Blade templates so that they are stored in a writable location for WordPress on Pantheon:

'compiled' => wp_upload_dir()['basedir'].'/storage/framework/views'

Step 3: Creating a Symlink for the Storage Directory

Next, we need to create a symbolic link from the theme directory to the storage/ folder within wp-content/uploads. From our theme directory, run the following command:

ln -sfn ../../uploads/storage

This keeps your theme files separate from uploaded content, making deployments and version control easier.

Step 4: Updating the Pantheon .gitignore File

Pantheon’s default .gitignore file excludes the /wp-content/cache directory, which we need to change. Comment out this line in the .gitignore file:

# /wp-content/cache

This prevents errors from the Acorn package, which requires this directory to exist. If you are working with a repository that you’ve already pushed to Pantheon, you may need to set your Pantheon environment to SFTP and manually upload the /wp-content/cache directory.

Step 5: Updating the Sage .gitignore File

Make sure the /vendor and /public directories are included in your repository, as they contain crucial files for Sage 10. Modify the Sage .gitignore file by commenting out these lines:

# /vendor
# /public

Additional Resources

For more insights, tips, and troubleshooting advice, visit the Roots Discourse. The community there is a great resource for developers working with Sage 10 on Pantheon.

Check out the primary source for this guide on Roots Discourse: Sage 10 on Pantheon.

Conclusion

Integrating Sage 10 into Pantheon takes some careful setup, but following this guide will help you get everything running smoothly. For the latest information and best practices, always refer to the official Sage documentation and Pantheon’s developer resources.

Leave a Reply

Your email address will not be published. Required fields are marked *