Table of Contents

Template Caching

We affectionately refer to our template caching system as “AutoMagiCache”. It's a whole mess of very exciting regular expressions that will automatically pull in a page from your server, rewrite and cache your paths and images, and store it on our server.

What It Does

  1. Pulls in target URL.
  2. Strips any <base> tags.
  3. “Convenience replacements”, currently converting “http” to “https” links for:
    • Google Analytics
  4. Imports non-secure external CSS
    • Rewrites all image paths (*.jpg, *.jpeg, *.png, *.gif) to use FoxyCart image caching.
    • Sticks it inline, inside CDATA comments.
  5. Imports non-secure external JS
    • Replaces / / with \/\/ when not preceded by a space or line break.
    • Replaces all </ with <\/.
    • Sticks it inline, inside CDATA comments.
  6. Rewrites all <img> paths to use FoxyCart image caching.
  7. Rewrites all <a> paths to point to the correct locations.
  8. Rewrites all <form> actions to point to correct locations.

What Is Supported?

Important Notes

Comments, Conditional Comments, and the Ampersand ("&")

For some reason, Firefox and Internet Explorer create problems when you have the ampersand (“&”) character inside of code comments:

<!--
Some text & more
-->

If you rely on conditional comments for Internet Explorer, and inside of those conditional comments you have ampersands, you'll need to use a very specific syntax to include your comments, detailed at Wellstyled.com. The important piece to notice is the <!–>, which needs to be included or you'll run into problems with the & being replaced by &amp; every time you save your template. We're still figuring this out.

Placeholders in your CSS or JS

The following placeholders will be replaced with “spaced” placeholders in cached CSS and JS, to prevent problems with parsing placeholders that shouldn't be parsed.

Caching Images Manually

If you don't want to use AutoMagiCache but still need your images securely cached you can do so. View the instructions here.