Permalink
Browse files

clean up code, support flatten

  • Loading branch information...
1 parent d877c88 commit 7abaf3e8d1201847a4f902c38ba6b9303b6b1ed7 @vanetix committed Mar 8, 2013
Showing with 9 additions and 7 deletions.
  1. +2 −1 Gruntfile.js
  2. +7 −6 tasks/mapper.js
View
@@ -28,7 +28,8 @@ module.exports = function(grunt) {
basic: {
cwd: 'test/cases',
assets: '../assets/*',
- src: ['*']
+ src: ['*'],
+ dest: 'tmp'
}
}
});
View
@@ -33,7 +33,6 @@ module.exports = function(grunt) {
*/
assets = grunt.file.expand({cwd: cwd}, f.assets);
- console.dir(assets);
/**
* Filter out non-existent files then iterate over all files
@@ -55,20 +54,22 @@ module.exports = function(grunt) {
});
src.forEach(function(p) {
- var s = f.dest ? f.dest : p;
+ var s;
+
+ p = f.flatten ? path.basename(p) : p;
+ s = f.dest ? path.join(f.dest, p) : p;
if(cwd) {
p = path.join(cwd, p);
}
- grunt.log.oklns(map(p, assets));
-
/**
- * If `f.dest` is set, save to `f.dest` otherwize
+ * If `f.dest` is set, save to `f.dest` otherwise
* overwrite the original
*/
- //grunt.file.write(map(p, assets), s);
+ grunt.log.writeln(''.green + s.grey);
+ grunt.file.write(s, map(p, assets));
});
});

0 comments on commit 7abaf3e

Please sign in to comment.