Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #55 from SAP/upgrade-less-theme-build
Browse files Browse the repository at this point in the history
openui5_theme: adapt to new API of less-openui5 v0.3.0
  • Loading branch information
matz3 authored Mar 24, 2017
2 parents d40e9c0 + 27c9782 commit 1566cb5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"connect-inject": "^0.4.0",
"connect-openui5": "^0.6.0",
"cors": "^2.7.1",
"less-openui5": "^0.2.0",
"less-openui5": "^0.3.0",
"maxmin": "^2.1.0",
"multiline": "^1.0.2",
"pretty-data": "^0.40.0",
Expand Down
32 changes: 20 additions & 12 deletions tasks/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

var path = require('path');
var async = require('async');
var lessOpenUI5 = require('less-openui5');
var less = require('less-openui5');

module.exports = function(grunt) {

Expand All @@ -30,6 +30,8 @@ module.exports = function(grunt) {
compiler: {}
});

var builder = new less.Builder();

// TODO check no file

// Iterate over all specified file groups.
Expand All @@ -47,17 +49,20 @@ module.exports = function(grunt) {
// TODO check no file

async.concatSeries(files, function(file, next) {
// make sure parser.filename is set
var parserOptions = grunt.util._.extend({}, options.parser, {
filename: file
});
lessOpenUI5.build(grunt.file.read(file), grunt.util._.extend({}, options, {
parser: parserOptions
}), function(err, result) {
if (err) {
nextFileObj(err);
return;
}

if (options.rootPaths) {

// Map rootpaths and get lessInputPath
options.rootPaths.forEach(function(path) {
if (file.indexOf(path) !== -1) {
file = file.substring(path.length);
}
});
}

builder.build(grunt.util._.extend({}, options, {
lessInputPath: file
})).then(function(result) {

var destDir = path.dirname(fileObj.dest);

Expand All @@ -75,6 +80,9 @@ module.exports = function(grunt) {
grunt.log.writeln('File ' + parametersDestFile + ' created.');

process.nextTick(next);

}, function(err) {
nextFileObj(err);
});
}, function() {
nextFileObj();
Expand Down

0 comments on commit 1566cb5

Please sign in to comment.