packages/codemods/v5-0-0/12-migrate-meta-styles.md
meta.styles → Direct CSS Imports (Custom Block Plugins)The meta.styles pipeline is removed in Lowdefy v4.8. Custom block plugins that used meta.styles = ['style.less'] to register stylesheets must switch to direct import './style.css' statements in the block component file.
This migration targets local plugin source code (JS/TS), not YAML configs.
plugins — scan JS/TS files in local plugin directories.
For each custom block plugin:
meta.styles from block component filesFind lines like:
BlockName.meta = {
category: 'display',
styles: ['style.less'],
};
Remove the styles entry:
BlockName.meta = {
category: 'display',
};
types.jsFind patterns like:
const styles = {};
styles.BlockName = Block.meta.styles;
export { styles };
Remove the styles variable, the loop/assignments, and the styles export.
.less filesFor each .less file referenced by meta.styles:
Dead imports (remove): If the .less file only imports antd's Less (@import '~antd/dist/antd.less' or similar) with no other CSS, delete it.
Convertible (rename to .css): If the .less file contains plain CSS without Less-specific syntax:
@import lines@layer components { }.css (same name, different extension).less fileComplex Less (manual): If the file uses Less variables (@var), functions (darken(), lighten()), mixins, or nested & selectors — convert to plain CSS manually first.
In the block component file, add:
import './style.css';
Glob in plugin directories: **/*.{js,jsx,ts,tsx}
Grep: meta.styles or styles:.*\.less
Also check: **/types.js for styles aggregation.
import React from 'react';
import './MyBlock.less';
const MyBlock = ({ properties }) => {
return <div>{properties.title}</div>;
};
MyBlock.meta = {
category: 'display',
styles: ['MyBlock.less'],
};
export default MyBlock;
import React from 'react';
import './MyBlock.css';
const MyBlock = ({ properties }) => {
return <div>{properties.title}</div>;
};
MyBlock.meta = {
category: 'display',
};
export default MyBlock;
@import '~antd/dist/antd.less';
.my-block {
padding: 16px;
border: 1px solid #d9d9d9;
}
@layer components {
.my-block {
padding: 16px;
border: 1px solid #d9d9d9;
}
}
.less files that import from multiple antd sub-paths — remove all antd imports@ variables (not @import or @layer), darken(), lighten(), fade(), .mixin(), & .child nestingimport './style.css' line may already exist if the plugin was partially migratedmeta.styles may be an empty array — just remove it.less files should be imported by block componentsmeta.styles assignments should remainstyles exports in types.js