Skip to content

Commit

Permalink
fix include viewStyle assets in dynamic version generation
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiankaegy committed Jan 24, 2025
1 parent 94717c3 commit 4321d3b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/toolkit/utils/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ const transformBlockJson = (content, absoluteFilename) => {
return content;
}
const metadata = JSON.parse(rawMetadata);
const { version, style } = metadata;
const { version, style = [], viewStyle = [] } = metadata;

const styleArray = Array.isArray(style) ? style : [style];
const viewStyleArray = Array.isArray(viewStyle) ? viewStyle : [viewStyle];
const combinedStylesArray = [...styleArray, ...viewStyleArray];

// check whether the style property is defined and a local file path
const isFilePath = styleArray?.some((styleName) => styleName?.startsWith('file:'));
Expand All @@ -71,7 +73,7 @@ const transformBlockJson = (content, absoluteFilename) => {
let styleFileContentHash = '';

if (!hasVersion && isFilePath) {
styleArray.forEach((rawStylePath) => {
combinedStylesArray.forEach((rawStylePath) => {
if (!rawStylePath.startsWith('file:')) {
return;
}
Expand Down

0 comments on commit 4321d3b

Please sign in to comment.