Custom Solutions: Reusing RGE Studio Design Elements in SFMC
Beefree App is now RGE Studio!
The email design suite you already know and love just leveled up. We’re working hard to update our help center, but you still may see some references to the old product name.
Overview
Some teams build emails from reusable parts in Salesforce Marketing Cloud (SFMC). They design each part in RGE Studio, like a header or footer. Then they assemble the parts into a full email inside SFMC.
RGE Studio exports complete emails by default. This article describes a custom solution we built for this use case. It’s not publicly available at this time.
Would you like to discuss a similar solution for your team? Let us know. We will review your use case and help you find the right next step.
Why components lose mobile styles
Reusing parts of an email creates two problems. Both come down to how CSS works in email. RGE Studio places most styles inline, directly on each HTML element. Learn more in Inline CSS.
The first problem involves mobile styles. Unlike other styles, they sit in the email's <head> section. Each rule uses class names created for that one email. Learn more in How can I understand the HTML that RGE Studio generates?
This works when you send the email exactly as exported. Problems start when you reuse components across emails.
For example, you pair a header from Email A with a footer from Email B. The footer's mobile styles stay in Email B's <head>. They were also written for Email B's class names. As a result, the footer looks correct on desktop. On mobile, it loses its responsive layout.
This is the orphaned styles problem. The CSS gets separated from its content when you move the content.
The second problem involves Gmail. You might try to keep each component's CSS with the component. For example, you could place that CSS in a <style> tag inside the <body>. We do not recommend this approach. Gmail removes these tags unless both the sender and recipient use Gmail. Recipients using other email clients lose the mobile layout without warning.
So all CSS must sit in the <head> section, and there should only be one. That means every component's styles must be combined in one place before you send.
Split export and parent template
The custom solution has two parts. A custom export option changes what RGE Studio exports. A parent template in SFMC then puts the parts back together.
What changes in the export
With the custom export option, each component exports as two separate fragments. These replace one complete email:
- CSS fragment: The component's mobile styles only. These are wrapped in media queries. Media queries are CSS rules that apply only on certain screen sizes. All other styles sit inline in the HTML. Inline styles are standard practice and work reliably in all email clients.
- HTML fragment: The visible markup of the component. All non-responsive styles are already applied inline.
If a component has no mobile styles, its CSS fragment is empty. To see a sample export, download the example files at the end of this article.
How the parts come together
The parent template is a pre-built HTML wrapper stored in SFMC. It is the single, shared structure for every email the team sends. It contains:
- The document structure: <html>, <head>, and <body>.
- Base CSS rules that apply to all exported emails. These rules never change.
- Zones in the <head> where each component's CSS fragment goes.
- Zones in the <body> where each component's HTML fragment goes.
- A few brand settings: background color, font, and email width.
Brand settings rarely need to change. When they do, a developer edits the parent template directly. The example files at the end of this article include a simplified parent template.
AMPscript is SFMC's scripting language. SFMC uses it to pull content into emails at send time. This solution uses the AMPscript function ContentBlockByKey. It finds a content block in SFMC's library by the block's Customer Key.
This is the most reliable way to reference blocks in SFMC. It keeps working when you move or rename a block.
The parent template uses two AMPscript calls per component. One pulls the CSS fragment into the <head>. The other pulls the HTML fragment into the <body>. When SFMC sends the email, it assembles the full email from these parts.
This custom solution uses the RGE Studio email name as the Customer Key. For example, a team might name a header AUG26_news_header. Their RGE Studio names and SFMC keys stay in sync. This gives the team a predictable naming system.
The complete workflow
Here is how a team uses the custom export options:
- The team creates each component in RGE Studio as its own email. They name it using their own naming rules.
- They export the component to SFMC using a custom "HTML" format. The standard connector exports in the "HTML Email" format.
- RGE Studio sends two content blocks to SFMC. One holds the CSS fragment. The other holds the HTML fragment.
- Both blocks use the RGE Studio email name as their Customer Key. RGE Studio adds _HEAD to the end of the CSS block's key. It adds _BODY to the end of the HTML block's key.
- In SFMC, a developer adds AMPscript references for both blocks to the parent template.
- When the email sends, SFMC assembles it. It places the CSS in the <head> and the HTML in the <body>. Recipients get a correctly rendered email.
Important considerations
Keep these points in mind when planning a solution like this:
- SFMC's drag-and-drop editor only edits the <body>. This solution needs CSS in the <head>. So it works best with a team member who knows AMPscript. That person also needs to be comfortable editing the parent template directly.
- Each component needs its own references in the parent template. To add a component to an email, add two AMPscript calls to the parent template.
- Some teams need only one parent template. All their campaigns share a single layout. Other teams need several, even for a single brand. For example, they might use one for newsletters and one for transactional emails. Each one has its own structure and component zones. How many you need is part of planning a custom solution.
Example files
The attached files show a sample export and a simplified parent template. The sample export is a Title block with a different text alignment on mobile. The files include:
- The CSS fragment for the Title block.
- The HTML fragment for the Title block.
- A simplified parent template. Generic CSS rules are removed to make it easier to read.
If you have any questions, feel free to contact us.
Comments
0 comments
Please sign in to leave a comment.