less-openui5
Advanced tools
Comparing version 0.5.2 to 0.5.3
@@ -0,1 +1,11 @@ | ||
# 0.5.3 (2018-05-18) | ||
### Fixes | ||
- Fix less error propagation [#22](https://github.com/SAP/less-openui5/pull/22) | ||
- Fix inline theme parameters encoding for '#' [#23](https://github.com/SAP/less-openui5/pull/23) | ||
### All changes | ||
[`0.5.2...0.5.3`](https://github.com/SAP/less-openui5/compare/0.5.2...0.5.3) | ||
# 0.5.2 (2018-03-26) | ||
@@ -2,0 +12,0 @@ |
@@ -175,24 +175,22 @@ // Copyright 2018 SAP SE. | ||
function compile(config) { | ||
return new Promise(function(resolve, reject) { | ||
var parserOptions = clone(options.parser); | ||
var rootpath; | ||
var parserOptions = clone(options.parser); | ||
var rootpath; | ||
if (config.path) { | ||
// Keep rootpath for later usage in the ImportCollectorPlugin | ||
rootpath = config.path; | ||
parserOptions.filename = config.localPath; | ||
} | ||
if (config.path) { | ||
// Keep rootpath for later usage in the ImportCollectorPlugin | ||
rootpath = config.path; | ||
parserOptions.filename = config.localPath; | ||
} | ||
// Keep filename for later usage (see ImportCollectorPlugin) as less modifies the parserOptions.filename | ||
var filename = parserOptions.filename; | ||
// Keep filename for later usage (see ImportCollectorPlugin) as less modifies the parserOptions.filename | ||
var filename = parserOptions.filename; | ||
// Only use custom file handler when "rootPaths" or custom "fs" are used | ||
var fnFileHandler; | ||
if ((options.rootPaths && options.rootPaths.length > 0) || that.customFs) { | ||
fnFileHandler = fileHandler; | ||
} | ||
// Only use custom file handler when "rootPaths" or custom "fs" are used | ||
var fnFileHandler; | ||
if ((options.rootPaths && options.rootPaths.length > 0) || that.customFs) { | ||
fnFileHandler = fileHandler; | ||
} | ||
return new Promise(function(resolve, reject) { | ||
var parser = createParser(parserOptions, fnFileHandler); | ||
parser.parse(config.content, function(err, tree) { | ||
@@ -202,43 +200,45 @@ | ||
reject(err); | ||
return; | ||
} else { | ||
resolve(tree); | ||
} | ||
}); | ||
}).then(function(tree) { | ||
var result = {}; | ||
var result = {}; | ||
result.tree = tree; | ||
result.tree = tree; | ||
// plugins to collect imported files and variable values | ||
var oImportCollector = new ImportCollectorPlugin({ | ||
importMappings: mFileMappings[filename] | ||
}); | ||
var oVariableCollector = new VariableCollectorPlugin(options.compiler); | ||
// plugins to collect imported files and variable values | ||
var oImportCollector = new ImportCollectorPlugin({ | ||
importMappings: mFileMappings[filename] | ||
}); | ||
var oVariableCollector = new VariableCollectorPlugin(options.compiler); | ||
// render to css | ||
result.css = tree.toCSS(assign(options.compiler, { | ||
plugins: [ oImportCollector, oVariableCollector ] | ||
})); | ||
// render to css | ||
result.css = tree.toCSS(assign(options.compiler, { | ||
plugins: [ oImportCollector, oVariableCollector ] | ||
})); | ||
// retrieve imported files | ||
result.imports = oImportCollector.getImports(); | ||
// retrieve imported files | ||
result.imports = oImportCollector.getImports(); | ||
// retrieve reduced set of variables | ||
result.variables = oVariableCollector.getVariables(Object.keys(mFileMappings[filename] || {})); | ||
// retrieve reduced set of variables | ||
result.variables = oVariableCollector.getVariables(Object.keys(mFileMappings[filename] || {})); | ||
// retrieve all variables | ||
result.allVariables = oVariableCollector.getAllVariables(); | ||
// retrieve all variables | ||
result.allVariables = oVariableCollector.getAllVariables(); | ||
// also compile rtl-version if requested | ||
if (options.rtl) { | ||
result.cssRtl = tree.toCSS(assign(options.compiler, { | ||
plugins: [ new RTLPlugin() ] | ||
})); | ||
} | ||
// also compile rtl-version if requested | ||
if (options.rtl) { | ||
result.cssRtl = tree.toCSS(assign(options.compiler, { | ||
plugins: [ new RTLPlugin() ] | ||
})); | ||
} | ||
if (rootpath) { | ||
result.imports.unshift(rootpath); | ||
} | ||
if (rootpath) { | ||
result.imports.unshift(rootpath); | ||
} | ||
resolve(result); | ||
return result; | ||
}); | ||
}); | ||
@@ -253,3 +253,3 @@ } | ||
// escape all chars that could cause problems with css parsers using URI-Encoding (% + HEX-Code) | ||
var escapedChars = "%{}()'\"\\"; | ||
var escapedChars = "%{}()'\"\\#"; | ||
for (var i = 0; i < escapedChars.length; i++) { | ||
@@ -256,0 +256,0 @@ var char = escapedChars.charAt(i); |
{ | ||
"name": "less-openui5", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "Build OpenUI5 themes with Less.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -415,3 +415,3 @@ // Copyright 2018 SAP SE. | ||
it('should have correct error in case of undefined variable usage', function() { | ||
it('should have correct error in case of undefined variable usage (lessInput)', function() { | ||
@@ -432,2 +432,19 @@ return new Builder().build({ | ||
it('should have correct error in case of undefined variable usage (lessInputPath)', function() { | ||
return new Builder().build({ | ||
lessInputPath: 'main.less', | ||
rootPaths: ['test/fixtures/error'] | ||
}).then(function(result) { | ||
// no resolve | ||
assert.ok(false); | ||
}, function(err) { | ||
assert.ok(err); | ||
}); | ||
}); | ||
}); | ||
@@ -434,0 +451,0 @@ |
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
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
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
257717
144
5316