webflow.getAllStyles()
webflow.getAllStyles()
Retrieve all Styles, also known as Classes, present on the Webflow site.
Syntax
webflow.getAllStyles(): Promise<Array<Style>>
Returns
Promise<Array<Style>>
A Promise that resolves to an array of Style objects representing all the styles present on the current site.
Example
// Get all Styles
const allStyles = await webflow.getAllStyles();
// List Styles
if (allStyles.length > 0) {
console.log("List of all styles:");
allStyles.forEach(async (style, index) => {
// Print style names and ids
console.log(`${index + 1}. Style Name: ${await style.getName()}, Style ID: ${style.id}`);
});
} else {
console.log("No styles found in the current context.");
}
Designer Ability
Checks for authorization only
Designer Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canAccessCanvas | Any | Any | Any | Any |