![OpenUI5](http://openui5.org/images/OpenUI5_new_big_side.png)
![NPM Version](http://img.shields.io/npm/v/less-openui5.svg?style=flat)
less-openui5
Build OpenUI5 themes with Less.js.
Install
npm install less-openui5
Usage
var lessOpenUI5 = require('less-openui5');
var builder = new lessOpenUI5.Builder();
builder.build({
lessInput: '@var: #ffffff; .class { color: @var; float: left }'
})
.then(function(result) {
console.log(result.css);
console.log(result.cssRtl);
console.log(result.variables);
console.log(result.imports);
builder.clearCache();
});
API
new Builder()
Creates a new Builder
instance.
It caches build results to only rebuild a theme when related files have been changed.
This is mainly relevant when building themes as part of a server middleware like connect-openui5
.
.build(options)
Returns a Promise resolving with a result
object.
options
lessInput
Required (either lessInput
or lessInputPath
, not both)
Type: string
Input less content.
lessInputPath
Required (either lessInput
or lessInputPath
, not both)
Type: string
Path to input less file.
When rootPaths
is given this must be a relative path inside one of the provided rootPaths
, otherwise just a regular filesystem path.
rtl
Type: boolean
Default: true
Create mirrored css for right-to-left support.
rootPaths
Type: array
of string
Root paths to use for import directives.
This option differs from the less compiler.paths
option.
It is useful if less files are located in separate folders but referenced as they would all be in one.
Example
rootPaths: [ './lib1', './lib2' ]
Folder structure
lib1
my
themes
foo
foo.less
lib2
my
themes
bar
bar.less
lib2/my/themes/bar/bar.less
@import "../foo/foo.less";
parser
Type: object
Options for the less parser (less.Parser
).
Note: Default of relativeUrls
option is changed from false
to true
.
compiler
Type object
Options for the less compiler (tree.toCss
).
library.name
Type string
Dot-separated name of the corresponding library.
It will be used to inline the variables
JSON as data-uri which can be retrieved at runtime.
result
css
Type: string
Regular css output.
cssRtl
Type: string
Mirrored css for right-to-left support (if rtl option was enabled).
variables
Type: object
Key-value map of all global less variables (without @ prefix).
imports
Type: array
Paths to files imported via import directives.
.clearCache()
Clears all cached build results.
Use this method to prevent high memory consumption when building many themes within the same process.
Contributing
See CONTRIBUTING.md.
Release History
See CHANGELOG.md.
Lisense
Apache License 2.0 © 2017 SAP SE