module.exports = function(config, lessConfig, pathConfig) {
  'use strict';
  var path = require('path');

  var file = {};
  if(pathConfig.plugin) {
    file[pathConfig.buildTarget+'/plugin.css'] = pathConfig.sourceDir + '/styles.less';
  } else {
    file[pathConfig.buildTarget+'/styles/styles.css'] = pathConfig.sourceDir + '/styles/styles.less';
  }

  var ee = config.pkg.name === 'camunda-bpm-webapp-ee';
  var eePrefix = ee ? 'node_modules/camunda-bpm-webapp/' : '';
  var includePaths = [
    '<%= pkg.gruntConfig.commonsUiDir %>/lib/widgets',
    '<%= pkg.gruntConfig.commonsUiDir %>/resources/less',
    '<%= pkg.gruntConfig.commonsUiDir %>/resources/css',
    '<%= pkg.gruntConfig.commonsUiDir %>/node_modules',
    eePrefix + 'ui/common/styles',
    eePrefix + 'ui/' + pathConfig.appName + '/client/styles',
    eePrefix + 'ui/' + pathConfig.appName + '/client/scripts'
  ];

  var outputFilepath = Object.keys(file)[0];

  lessConfig[pathConfig.appName + (pathConfig.plugin ? '_plugin' : '') + '_styles'] = {
    options: {
      paths: includePaths,

      compress: true,

      sourceMap: true,
      sourceMapFilename: (pathConfig.plugin ? 'plugin' : 'styles') + '.css.map',
      sourceMapURL: (pathConfig.plugin ? 'plugin' : 'styles') + '.css.map',
      sourceMapFileInline: false
    },
    files: file
  };

  if (pathConfig.appName === 'cockpit' && !pathConfig.plugin) {
    file = {};
    outputFilepath = pathConfig.buildTarget + '/styles/styles-components.css';
    file[outputFilepath] = pathConfig.sourceDir + '/styles/styles-components.less';

    lessConfig.cockpit_styles_components = {
      options: {
        paths: includePaths,

        compress: true,

        sourceMap: true,
        sourceMapFilename: 'styles-components.css.map',
        sourceMapURL: './styles-components.css.map',
        sourceMapFileInline: false
      },
      files: file
    };
  }
};

@@ -1067,35 +1067,36 @@
       compress: 
-tru
+fals
 e,%0A%0A      source
@@ -1135,57 +1135,26 @@
 me: 
-(pathConfig.plugin ? 'plugin' : 'styles') + '.css
+outputFilepath + '
 .map
@@ -1175,16 +1175,23 @@
 eMapURL:
+ './' +
  (pathCo
@@ -1262,28 +1262,27 @@
 FileInline: 
-fals
+tru
 e%0A    %7D,%0A   
@@ -1653,19 +1653,20 @@
 mpress: 
-tru
+fals
 e,%0A%0A    
@@ -1717,30 +1717,26 @@
 me: 
-'styles-components.css
+outputFilepath + '
 .map
@@ -1820,20 +1820,19 @@
 Inline: 
-fals
+tru
 e%0A      

correct the source map paths