less-openui5 is a utility library designed to build OpenUI5 themes using the Less.js preprocessor. It provides a `Builder` class that compiles Less input into standard CSS, including an automatically mirrored CSS variant for right-to-left (RTL) language support, and extracts Less variables. The current stable version is 0.11.6. While recent releases primarily contain bug fixes, major versions introduce breaking changes. A key differentiator is its specialized focus on OpenUI5's theming concept, including features like caching build results to optimize performance, especially in server middleware scenarios, and the ability to define custom file system interfaces for advanced use cases. It simplifies the complex process of OpenUI5 theme development by handling Less compilation and RTL variant generation within a dedicated tool.
npm install less-openui5Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the Less OpenUI5 Builder, compile a simple Less string into regular and RTL CSS, extract global Less variables, and properly clear the builder's cache after use.
Review Less files and remove any JavaScript expressions or functions (e.g., `calc(1 + unit(1, 'px'))`). Ensure all calculations and logic are handled using native Less features.
Modify `@import` statements to reference local file paths. For remote resources, pre-fetch them to the local file system or implement a custom `fs` interface for the Builder to handle them.
Upgrade your Node.js runtime to version 10 or higher. For the latest versions of `less-openui5`, Node.js 20.11.0 or 22.0.0+ is required.
Ensure that if your theme relies on specific RTL image variants, the corresponding `img-RTL` directory and mirrored image files are correctly structured and present in your project. Otherwise, the paths will not be transformed.
Avoid passing `sourceMap` or `cleancss` options to the `compiler` configuration when invoking the `build` method. Handle source map generation and CSS minification using external tools or post-processing steps.
Stay updated with the latest patch releases for `less-openui5` to benefit from dependency maintenance. Report any unexpected CSS parsing or output issues to the package maintainers.
Remove the `javascriptEnabled: true` option from `parser` configurations and refactor Less code to avoid JavaScript expressions.
Download the remote Less file to your local file system and update the `@import` path to a local reference. Alternatively, provide a custom `fs` option to the `Builder` that can resolve network resources.
Remove the `sourceMap` option from the `compiler` configuration. Implement source map generation as a separate post-processing step if required.
Remove the `cleancss` option from the `compiler` configuration. Implement CSS minification using a dedicated minifier tool as a separate post-processing step.