packages/codemods/v5-0-0/10-detect-styles-less.md
public/styles.less → Theme YAML + CSSLowdefy v4 supported public/styles.less for custom styling with Less variables that mapped to antd's Less-based theming. Antd v6 uses CSS-in-JS with design tokens. Less is no longer processed by the build.
public/styles.less existslowdefy.yaml theme configpublic/styles.css| Less Variable | Antd Token |
|---|---|
@primary-color | colorPrimary |
@link-color | colorLink |
@success-color | colorSuccess |
@warning-color | colorWarning |
@error-color | colorError |
@font-size-base | fontSize |
@heading-color | colorTextHeading |
@text-color | colorText |
@text-color-secondary | colorTextSecondary |
@disabled-color | colorTextDisabled |
@border-radius-base | borderRadius |
@border-color-base | colorBorder |
@box-shadow-base | boxShadow |
@body-background | colorBgContainer |
For each variable found, generate the equivalent theme.antd.token YAML:
# Add to lowdefy.yaml
theme:
antd:
token:
colorPrimary: '#1890ff'
fontSize: 14
borderRadius: 4
Flag these for manual conversion:
.mixin())darken(), lighten(), fade())&@import statements (other than antd imports)Convert remaining plain CSS to public/styles.css.
Check: public/styles.less
@primary-color: #1890ff;
@border-radius-base: 6px;
@font-size-base: 14px;
.custom-header {
padding: 16px;
background: @primary-color;
}
theme:
antd:
token:
colorPrimary: '#1890ff'
borderRadius: 6
fontSize: 14
.custom-header {
padding: 16px;
background: var(--ant-color-primary);
}
styles.less contains only variables and no custom CSS, only the lowdefy.yaml theme config is needed — no styles.cssdarken(@primary-color, 10%) have no direct token equivalent — flag these for manual conversion to CSS custom properties or hardcoded values@import '~antd/dist/antd.less') — these lines can be removed entirely (antd v6 doesn't use Less)lowdefy.yaml already has a theme: section, merge the tokens into itpublic/styles.lessAfter migrating, you MUST delete public/styles.less. The v5 build checks for this file and throws a fatal ConfigError if it exists — even if it's empty. The build will not proceed until the file is removed.
rm public/styles.less
public/styles.less must NOT exist — the build will fail if it doeslowdefy.yaml under theme.antd.tokenpublic/styles.css