Registry / web-framework / less-openui5

less-openui5

JSON →
library0.11.6jsnpmunverified

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-openui5
INSTALL
IMPORT
SIG · LESS-OPENUI5
L
less-openui5
web-frameworkjavascriptv0.11.6
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Builder
import { Builder } from 'less-openui5'; const builder = new Builder();
const lessOpenUI5 = require('less-openui5'); const builder = new lessOpenUI5.Builder();
While the README uses CommonJS `require`, ESM named imports for `Builder` are the modern approach. The package internally provides a `Builder` class.
lessOpenUI5
import * as lessOpenUI5 from 'less-openui5'; const builder = new lessOpenUI5.Builder();
import lessOpenUI5 from 'less-openui5'; // No default export
The package provides an object with `Builder` as a property, so a namespace import (`* as`) is appropriate for ESM when not directly importing `Builder`.

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.

import { Builder } from 'less-openui5'; const builder = new Builder(); builder.build({ lessInput: ` @mainColor: #337ab7; @headingFont: 'Arial', sans-serif; .my-app { background-color: @mainColor; h1 { font-family: @headingFont; color: darken(@mainColor, 10%); text-align: left; } p { margin-left: 10px; } } ` }) .then((result) => { console.log('--- Regular CSS ---'); console.log(result.css); console.log('\n--- RTL CSS ---'); console.log(result.cssRtl); console.log('\n--- Global Variables ---'); console.log(result.variables); }) .catch((error) => { console.error('Theme build failed:', error); }) .finally(() => { builder.clearCache(); // Essential for long-running processes });
less-openui5 --version
Debug
Known issues
breakingAs of v0.10.0, JavaScript execution within Less.js is permanently disabled. The `javascriptEnabled` parser option has been removed and cannot be enabled.
fix
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.
affects: >=0.10.0
breakingSince v0.9.0, importing Less files over HTTP(S) is no longer supported. All Less imports must be local file system paths.
fix
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.
affects: >=0.9.0
breakingVersion 0.9.0 introduced a minimum Node.js requirement of `engines.node: '>= 10'`. Later versions (`package.json` at source) specify `^20.11.0 || >=22.0.0`.
fix
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.
affects: >=0.9.0
breakingIn v0.11.0, the logic for rewriting image paths for the RTL-variant changed. Paths are now only rewritten if the target RTL-specific files actually exist.
fix
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.
affects: >=0.11.0
gotchaThe `compiler` options `sourceMap` and `cleancss` are not supported and will throw an exception if used.
fix
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.
affects: *
gotchaThere have been multiple fixes and reverts related to switching to a maintained fork of the 'css' package in versions 0.11.3, 0.11.5, and 0.11.6. This indicates potential instability or dependency issues in the underlying CSS parsing/manipulation.
fix
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.
affects: 0.11.3, 0.11.5, 0.11.6
Errors
Common errors & fixes
Error: Parser option `javascriptEnabled` has been removed.
Attempting to enable or use JavaScript within Less code after v0.10.0.
fix
Remove the `javascriptEnabled: true` option from `parser` configurations and refactor Less code to avoid JavaScript expressions.
Error: No matching resource found for 'http(s)://...' in root paths.
Attempting to `@import` a Less file from an HTTP(S) URL, which is no longer supported since v0.9.0.
fix
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.
The `sourceMap` option is not supported. An exception will be thrown when used.
Passing `sourceMap: true` (or any value) in the `compiler` options.
fix
Remove the `sourceMap` option from the `compiler` configuration. Implement source map generation as a separate post-processing step if required.
The `cleancss` option is not supported. An exception will be thrown when used.
Passing `cleancss: true` (or any value) in the `compiler` options.
fix
Remove the `cleancss` option from the `compiler` configuration. Implement CSS minification using a dedicated minifier tool as a separate post-processing step.
Upgrade
Version history
0.11.6latest on npm
Audit
Dependencies
lessrequiredCore dependency for Less compilation, tightly coupled internally.
@adobe/css-toolsrequiredUsed for CSS manipulation, likely related to RTL transformations or parsing.
Agent activity
2 hits · last 30 days
node
2
Resources