Legacy Knowledge Base
Published Jun. 30, 2025

Unable to build theme: "Error: Expected number, variable, function, or calculation. log('Invalid unit `#{$unit}`.');"

Written By

Daniel Carrillo Broeder

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

Issue

  • When building a theme there are 'Expected number, variable, function, or calculation $_: log('Invalid unit `#{$unit}`.');' errors:
    Message:
    build/_css/clay/functions/_type-conversion-functions.scss
    Error: Expected number, variable, function, or calculation.

    40 │ $_: log('Invalid unit `#{$unit}`.');
    │ ^

    build/_css/clay/functions/_type-conversion-functions.scss 40:11 @import
    build/_css/clay/functions/_global-functions.scss 9:9 @import
    build/_css/clay/base.scss 5:9 @import
    build/_css/clay.scss 1:9 root stylesheet
    Details:
    formatted: Error: Expected number, variable, function, or calculation.

Environment

  • Liferay DXP 7.3+, when building themes with blade templates.

Resolution

  • This error is due to using sass version 1.65.1.
  • It is fixed in "liferay-theme-tasks" v11.5.3.
  • You just need to rebuild dependencies in the theme to fix the issue:
    # NPM
    npm install && npm run build

    # Or alternatively
    yarn && yarn build
  • If you still have problems, you can manually change theme's package.json. Update "liferay-theme-tasks" to at least version 11.5.3:
    ...
    "devDependencies": {
    "compass-mixins": "0.12.10",
    "gulp": "4.0.2",
    "liferay-frontend-css-common": "6.0.8",
    "liferay-frontend-theme-styled": "6.0.54",
    "liferay-frontend-theme-unstyled": "6.0.45",
    "liferay-theme-tasks": "^11.5.3",
    "liferay-font-awesome": "3.5.2"
    },
    ...

 Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base