1

指定したファイルを各ディレクトリに再帰的にコピーするタスクを構成して実行したいと思います。具体的には、Web プロジェクトの各ディレクトリとサブディレクトリに "index.php" をコピーしたいと考えています (存在しない場合)。を使用しようとしましたが、ワイルドカードを使用multidestしてパスを指定できないようです (残念です!)。どうすればこれを解決できますか?ありがとうございましたcopymultidest

grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    multidest: {
        tst: {
                tasks: ['copy:indexphp'],
                dest: '**/' //THIS DOESN'T WORK, I SHOULD SPECIFY ANY DIR/SUBDIR/ETC.. 
        },
    },

    copy: {
        indexphp: {
            expand: true,
            cwd: 'classes',
            src: 'index.php',
            filter: function (filepath) {
                // NPM load file path module.
                var path = require('path');

                // Construct the destination file path.
                var dest = path.join(
                    grunt.task.current.data.dest,
                    path.basename(filepath)
                );

                // Return false if the file exists.
                return !(grunt.file.exists(dest));
            }
        },
[...]
4

0 に答える 0