grunt-zuckrig-closure
Version:
Reduce a verbose syntax for Google Closure Compiler to be more Pythonic/Rubistic.
31 lines (30 loc) • 877 B
JavaScript
module.exports = function(grunt) {
var zuckrig;
zuckrig = require('../tasks/zuckrig_filter').zuckrig;
return grunt.registerMultiTask('zuckrig', 'Reduce a verbose syntax for Google Closure Compiler to be more Pythonist/Rubist.', function() {
var count, opts;
count = 0;
opts = this.options({
filter: function() {
return true;
}
});
this.files.forEach(function(f) {
var e, file;
if (!opts.filter(f.dest)) {
return;
}
try {
file = grunt.file.read(f.dest);
file = zuckrig(file);
grunt.file.write(f.dest, file);
return count++;
} catch (_error) {
e = _error;
grunt.log.writeln(['File', f.dest, 'failed'].join(' '));
return grunt.log.error(e);
}
});
return grunt.log.ok("" + count + " files fixed by Zuckrig Closure.");
});
};