Versioning
Versioning enables HubSpot to release new versions of default assets without impacting your existing content. For example, if HubSpot releases a new version of a default asset, any website pages that use the previous version of the asset will continue to work as expected. HubSpot will only release a new version of a default asset if the changes impact the editor experience or they involve significant changes to the asset's UI.
When developing themes for multiple accounts, you can build versioning into them so that they work as expected regardless of the versions in the account.
When developing a theme, you won't necessarily know which version of an asset that an account is using. For example, the divider module can be either v0
or v1
. Therefore, you'll need to develop your theme to be compatible with both module versions.
HubSpot automatically maps v0
fields to v1
fields, so referencing v0
fields will enable the theme to work with both v0
and v1
modules. Field references are not backwards compatible, meaning that HubSpot will not automatically map v1
field references to v0
fields.
To account for changes in the module's HTML, CSS, and JavaScript, you can use conditional statements to configure modules depending on the account's available module versions.
Get an asset version
When setting up a conditional statement, you can get a module's version within an HTML, CSS, or JS file by using the following snippet: get_asset_version("@hubspot/module-name")
.
The module's version will be returned as a string, enabling you to configure module options based on the returned version.
Below, learn more about the modules that currently support versioning.
A new version of the default divider module has been released. This version update impacts the following module files:
Below, learn more about the new v1
version updates in each file.
Note the following divider module field updates in the new version:
- All fields that were previously in the Content tab have been moved to the Styles tab.
- The following fields have moved, but HubSpot automatically links the previous references to the new field names, so you don't need to make any manual updates:
- The
height
field has been moved tostyles.line.thickness
. - The
width
field has been moved tostyles.size.width
. - The
color
field has been moved tostyles.line.color
. - The
line
type field has been moved tostyles.line.style
.
- The
- The
alignment
field, which was previously a choice field, has been replaced by a new field type of Alignment, and can be accessed understyles.alignment.alignment
. - The
padding
field, which was previously a number field, has been replaced by a new field type of Spacing, and can be accessed understyles.spacing.spacing
. - The Show padding? field has been removed.
Note that the only difference in the divider module's HTML in v1
is that the styles that are applied to a horizontal rule get applied via <style>
tags in the head of the page, as opposed to being set via inline styles in v0
.
Thank you for your feedback, it means a lot to us.