Make WordPress Core

Changeset 28798


Ignore:
Timestamp:
06/21/2014 08:02:47 PM (12 years ago)
Author:
wonderboymusic
Message:

Add a grunt jshint:plugins task.

Props MattyRob.
Fixes #28464.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Gruntfile.js

    r28796 r28798  
    274274                                        return false;
    275275                                }
     276                        },
     277                        plugins: {
     278                                expand: true,
     279                                cwd: SOURCE_DIR + 'wp-content/plugins',
     280                                src: [
     281                                        '**/*.js',
     282                                        '!**/*.min.js'
     283                                ],
     284                                // Limit JSHint's run to a single specified plugin folder:
     285                                //
     286                                //    grunt jshint:plugins --folder=foldername
     287                                //
     288                                filter: function( folderpath ) {
     289                                        var index, folder = grunt.option( 'folder' );
     290
     291                                        // Don't filter when no target folder is specified
     292                                        if ( ! folder ) {
     293                                                return true;
     294                                        }
     295
     296                                        folderpath = folderpath.replace( /\\/g, '/' );
     297                                        index = folderpath.lastIndexOf( '/' + folder );
     298
     299                                        // Match only the folder name passed from cli
     300                                        if ( -1 !== index ) {
     301                                                return true;
     302                                        }
     303
     304                                        return false;
     305                                }
    276306                        }
    277307                },
Note: See TracChangeset for help on using the changeset viewer.