cedaro / grunt-wp-i18n

Internationalize WordPress themes and plugins with Grunt.
MIT License
160 stars 25 forks source link

Addtextdomain throws error #82

Closed shivapoudel closed 5 years ago

shivapoudel commented 5 years ago

@bradyvercher With below snippet, I am receiving errors

        // Add Textdomain.
        addtextdomain: {
            options: {
                textdomain: target,
                updateDomains: ['everest-forms']
            },
            target: {
                files: {
                    cwd: target,
                    expand: true,
                    src: [
                        '**/*.php',         // Include all files
                        '!node_modules/**', // Exclude node_modules/
                        '!vendor/**'        // Exclude vendor/
                    ]
                }
            }
        },

Using Grunt option support grunt addtextdomain --target=everest-forms-mailchimp

The error was:

Warning: pattern.indexOf is not a function Use --force to continue.

Aborted due to warnings.
shivapoudel commented 5 years ago
        // Add Textdomain.
        addtextdomain: {
            options: {
                textdomain: target,
                updateDomains: ['everest-forms']
            },
            target: {
                files: [{
                    cwd: target,
                    expand: true,
                    src: [
                        '**/*.php',         // Include all files
                        '!node_modules/**', // Exclude node_modules/
                        '!vendor/**'        // Exclude vendor/
                    ],
                    filter: function() {
                        return 'development' !== target;
                    }
                }]
            }
        },

This fixes it :)