Use grunt-contrib-clean for cleaning build tasks

This commit is contained in:
Eric Ferraiuolo 2013-05-13 14:56:23 -04:00
parent dbb805f448
commit 75e2d50407
2 changed files with 32 additions and 13 deletions

View File

@ -22,6 +22,13 @@ grunt.initConfig({
'\n'
].join('\n'),
// -- Clean Config ---------------------------------------------------------
clean: {
build: ['build/'],
base : ['src/base/css/', 'src/base/tests/', 'src/base/LICENSE.md']
},
// -- CSSMin Config --------------------------------------------------------
cssmin: {
@ -77,9 +84,14 @@ grunt.initConfig({
// -- Main Tasks ---------------------------------------------------------------
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask('default', ['cssmin']);
grunt.registerTask('default', [
'clean:build',
'cssmin'
]);
grunt.registerTask('base', ['cssmin:base']);
grunt.registerTask('buttons', ['cssmin:buttons']);
grunt.registerTask('forms', ['cssmin:forms']);
@ -89,15 +101,6 @@ grunt.registerTask('tables', ['cssmin:tables']);
// -- Import Tasks -------------------------------------------------------------
grunt.registerTask('base-clean', 'Clean Source Tree', function () {
var files = grunt.file.expand(grunt.config('BASE_DIR') + 'css/*.css');
files.forEach(function (file) {
grunt.log.writeln('Deleting: '.red + file.cyan);
grunt.file['delete'](file);
});
});
grunt.registerTask('base-import-css', 'Import Normalize CSS Files', function () {
var file = 'normalize.css',
src = path.join(grunt.config('NORMALIZE_LIB'), file),
@ -124,6 +127,19 @@ grunt.registerTask('base-import-tests', 'Import Normalize Tests', function () {
grunt.file.copy(src, dest);
});
grunt.registerTask('base-import-meta', 'Import Normalize License', function () {
var file = 'LICENSE.md',
src = path.join(grunt.config('NORMALIZE_LIB'), file),
dest = path.join(grunt.config('BASE_DIR'), file);
if (!grunt.file.exists(src)) {
grunt.fail.fatal('Did you clone normalize.css yet?');
}
grunt.log.writeln('Copying: '.green + file.cyan + ' to ' + dest.cyan);
grunt.file.copy(src, dest);
});
grunt.registerTask('base-create-context', 'Make context version', function () {
var context = grunt.config('COMMENT') + grunt.config('LICENSE'),
done = this.async(),
@ -206,14 +222,15 @@ grunt.registerTask('base-prep', 'Prep Normalize.css import', function () {
grunt.registerTask('base-all', [
'base-prep',
'base-clean',
'clean:base',
'base-import',
'base-create-context'
]);
grunt.registerTask('base-import', [
'base-import-css',
'base-import-tests'
'base-import-tests',
'base-import-meta'
]);
};

View File

@ -2,10 +2,12 @@
"name": "Kimono",
"version": "0.0.1",
"private": true,
"devDependencies": {
"grunt": "~0.4.1",
"parserlib": "~0.2.2",
"grunt-contrib-cssmin": "~0.6.0"
},
"dependencies": {
"grunt-contrib-clean": "~0.4.1"
}
}