/**
 * Clean generated files/tmp files for theme
 */
module.exports = function(gulp, projectPath, themePath) {
    var TASK_NAME = 'themeClean',
        FILES_SRC = '**/*.css',
        FILES_MAP_SRC = '**/*.css.map',
        TMP_SRC = '.tmp';

    return {
        name: TASK_NAME,
        task: function getThemeCleanTask(done) {
            var _subTasks = [],
                clean = require('gulp-clean'),
                merge = require('merge-stream');

            _subTasks.push(
                gulp
                    .src(
                        [themePath + FILES_SRC, themePath + FILES_MAP_SRC, themePath + TMP_SRC],
                        {
                            cwd: projectPath,
                            read: false,
                            allowEmpty: true
                        }
                    ).pipe(
                        clean({
                            force: true
                        })
                    )
            );

            return (_subTasks[0]);
        },
        setProjectPath: function (path) {
            projectPath = path;
        },
        setThemePath: function (path) {
            themePath = path;
        }
    }
};

