Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

less-openui5

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

less-openui5 - npm Package Compare versions

Comparing version 0.1.3 to 0.2.0

CHANGELOG.md

31

lib/index.js

@@ -45,5 +45,11 @@ // Copyright 2016 SAP SE.

parser: {},
compiler: {}
compiler: {},
library: {}
}, options);
// Set default of "relativeUrls" parser option to "true" (less default is "false")
if (!options.parser.hasOwnProperty("relativeUrls")) {
options.parser.relativeUrls = true;
}
var result = {

@@ -117,2 +123,25 @@ variables: {},

if (typeof options.library === "object" && typeof options.library.name === "string") {
var parameters = JSON.stringify(result.variables);
// escape all chars that could cause problems with css parsers using URI-Encoding (% + HEX-Code)
var escapedChars = "%{}()'\"\\";
for (var i = 0; i < escapedChars.length; i++) {
var char = escapedChars.charAt(i);
var hex = char.charCodeAt(0).toString(16).toUpperCase();
parameters = parameters.replace(new RegExp("\\" + char, "g"), "%" + hex);
}
var parameterStyleRule =
"\n/* Inline theming parameters */\n#sap-ui-theme-" +
options.library.name.replace(/\./g, "\\.") +
" { background-image: url('data:text/plain;utf-8," + parameters + "'); }\n";
// embed parameter variables as plain-text string into css
result.css += parameterStyleRule;
if (result.cssRtl) {
result.cssRtl += parameterStyleRule;
}
}
} catch (ex) {

@@ -119,0 +148,0 @@ err = ex;

2

package.json
{
"name": "less-openui5",
"version": "0.1.3",
"version": "0.2.0",
"description": "Build OpenUI5 themes with Less.js",

@@ -5,0 +5,0 @@ "scripts": {

@@ -113,3 +113,4 @@ ![OpenUI5](http://openui5.org/images/OpenUI5_new_big_side.png)

Options for the [less](http://lesscss.org) parser (`less.Parser`).
Options for the [less](http://lesscss.org) parser (`less.Parser`).
**Note:** Default of `relativeUrls` option is changed from `false` to `true`.

@@ -122,2 +123,9 @@ ##### compiler

##### 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.
#### callback(error, result)

@@ -155,4 +163,8 @@

## Release History
See [CHANGELOG.md](CHANGELOG.md).
## Lisense
[Apache License 2.0](http: //www.apache.org/licenses/LICENSE-2.0) © 2016 [SAP SE](http://www.sap.com)

@@ -253,2 +253,83 @@ // Copyright 2016 SAP SE.

it('should use "relativeUrls" parser option by default', function(done) {
lessOpenUI5.build(readFile('test/fixtures/imports/main.less'), {
parser: {
filename: 'main.less',
paths: [ 'test/fixtures/imports' ]
}
}, function(err, result) {
assert.ifError(err);
assert.equal(result.css, readFile('test/expected/imports/main.css'), 'css should be correctly generated.');
done();
});
});
it('should not rewrite urls when "relativeUrls" parser option is set to "false"', function(done) {
lessOpenUI5.build(readFile('test/fixtures/imports/main.less'), {
parser: {
filename: 'main.less',
paths: [ 'test/fixtures/imports' ],
relativeUrls: false
}
}, function(err, result) {
assert.ifError(err);
assert.equal(result.css, readFile('test/expected/imports/main-no-relativeUrls.css'), 'css should be correctly generated.');
done();
});
});
});
describe('inline theming parameters', function() {
it('should not include inline parameters when no library name is given', function(done) {
lessOpenUI5.build(readFile('test/fixtures/simple/test.less'), function(err, result) {
assert.ifError(err);
assert.ok(!/#sap-ui-theme-/.test(result.css), 'inline parameter rule should not be present.');
assert.ok(!/data:text\/plain/.test(result.css), 'data-uri should not be present.');
assert.equal(result.css, readFile('test/expected/simple/test.css'), 'css should be correctly generated.');
done();
});
});
it('should include inline parameters when library name is given', function(done) {
lessOpenUI5.build(readFile('test/fixtures/simple/test.less'), {
library: {
name: 'foo.bar'
}
}, function(err, result) {
assert.ifError(err);
assert.ok(/#sap-ui-theme-foo\\.bar/.test(result.css), 'inline parameter rule for library should be present.');
assert.ok(/data:text\/plain/.test(result.css), 'data-uri should be present.');
assert.equal(result.css, readFile('test/expected/simple/test-inline-parameters.css'), 'css should be correctly generated.');
done();
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc