Using CSS variables to reuse a single Embeddable for multiple brands
The powerful logic available in Embeddables means that it often makes sense to re-use a single Embeddable for multiple brands, if the general logic and content is consistent across those brands.
This doc shows you how to inject styles and content into an Embeddable from the parent page, so that its appearance can change based on the URL.
This method works well if you have a different page for each brand, each with the same Embeddable embedded in it.
Create CSS variables in a <style> tag in the parent page
<style>
tag in
the HTML that looks like this, replacing the variable names and styles with what you need for your brand:body {}
creates a CSS variable, which can be referred to later from inside the Embeddable in the Builder.Use those CSS variables in the Builder
var(--font-headings)
.var(--my-variable-name, [DEFAULT_VALUE])
.
var(--font-color, #676767)
.This method works well if you have a different page for each brand, each with the same Embeddable embedded in it.
Create CSS variables in a <style> tag in the parent page
<style>
tag in
the HTML that looks like this, replacing the variable names and styles with what you need for your brand:body {}
creates a CSS variable, which can be referred to later from inside the Embeddable in the Builder.Use those CSS variables in the Builder
var(--font-headings)
.var(--my-variable-name, [DEFAULT_VALUE])
.
var(--font-color, #676767)
.Depending on the exact load sequence, you may see the original styles flash up for a second.
Create an onload Action that sets the CSS variables
Use those CSS variables in the Builder
var(--font-headings)
.var(--my-variable-name, [DEFAULT_VALUE])
.
var(--font-color, #676767)
.Using CSS variables to reuse a single Embeddable for multiple brands
The powerful logic available in Embeddables means that it often makes sense to re-use a single Embeddable for multiple brands, if the general logic and content is consistent across those brands.
This doc shows you how to inject styles and content into an Embeddable from the parent page, so that its appearance can change based on the URL.
This method works well if you have a different page for each brand, each with the same Embeddable embedded in it.
Create CSS variables in a <style> tag in the parent page
<style>
tag in
the HTML that looks like this, replacing the variable names and styles with what you need for your brand:body {}
creates a CSS variable, which can be referred to later from inside the Embeddable in the Builder.Use those CSS variables in the Builder
var(--font-headings)
.var(--my-variable-name, [DEFAULT_VALUE])
.
var(--font-color, #676767)
.This method works well if you have a different page for each brand, each with the same Embeddable embedded in it.
Create CSS variables in a <style> tag in the parent page
<style>
tag in
the HTML that looks like this, replacing the variable names and styles with what you need for your brand:body {}
creates a CSS variable, which can be referred to later from inside the Embeddable in the Builder.Use those CSS variables in the Builder
var(--font-headings)
.var(--my-variable-name, [DEFAULT_VALUE])
.
var(--font-color, #676767)
.Depending on the exact load sequence, you may see the original styles flash up for a second.
Create an onload Action that sets the CSS variables
Use those CSS variables in the Builder
var(--font-headings)
.var(--my-variable-name, [DEFAULT_VALUE])
.
var(--font-color, #676767)
.