- Oto plik README i przykłady: https://github.com/gruntjs/grunt-contrib-copy/blob/master/README.md .
- Oto odpowiednia część kodu (której najwyraźniej nie rozumiem) z https://github.com/gruntjs/grunt-contrib-copy/blob/master/tasks/copy.js :
module.exports = function (grunt) { „użyj ścisłego”; var path = require ('path'); grunt.registerMultiTask ('copy', 'Copy files.', function () { var kindOf = grunt.util.kindOf; var options = this.options ({ processContent: false, processContentExclude: [] }); var copyOptions = { proces: options.processContent, noProcess: options.processContentExclude }; grunt.verbose.writeflags (opcje, „Opcje”); var dest; var isExpandedPair; var tally = { dirs: 0, pliki: 0 }; this.files.forEach (function (filePair) { isExpandedPair = filePair.orig.expand || fałszywe; filePair.src.forEach (function (src) { if (detectionDestType (filePair.dest) === 'directory') { dest = (isExpandedPair)? filePair.dest: unixifyPath (path.join (filePair.dest, src)); } else { dest = filePair.dest; } if (grunt.file.isDir (src)) { grunt.verbose.writeln ('Tworzenie' + dest.cyan); grunt.file.mkdir (dest); tally.dirs ++; } else { grunt.verbose.writeln ('Kopiowanie' + src.cyan + '->' + dest.cyan); grunt.file.copy (src, dest, copyOptions); tally.files ++; } }); });