Support for wildcards and dynamic file name generation When configuring Grunt tasks, grunttask
Copy: {// This is one of the Target dests: {expand: true, cwd: '<% = config. app %>/newFolder ', src: [' **/{a *, B * }.html '], dest:' <% = config. dist %>/newFolder ', ext :". shtml ", extDot:" first ", flatten: true, // remove the intermediate form. The following rename can be returned: rename: function (dest, fileName) {return dest + "/" + fileName ;}}}
Wildcard support: supported by the node-glob library built in node. js. These can be used in the various file configurations mentioned above.
1. * match any character/
2 ,? Match a single character,/
3. ** match any character, including/, so it is used in the directory path.
4. {} comma-separated "or" Operation (do not include spaces after the comma)
5 ,! Exclude a match
Dynamic file name generation:
If expand is set to true, the following option is enabled. If it is set to true, The placeholder (I .e., the *) of the following file name must be expanded to a specific file name.
The Directory of the file (input) to be processed relative to the path specified by this property for all src files in cwd
The path to be matched by src. Relative to cwd, it indicates the file to be processed. If an array is used, each item of the array is a file name. Wildcards can be used.
The destination path prefix generated by dest, indicating the processed file name or object
Ext indicates the suffix of the processed file. Replace the suffix of all generated target files with this attribute.
ExtDot: first: start after the first vertex after the file name as the suffix; last: start after the last vertex after the file name as the suffix name
Flatten: delete all generated dest path parts. The value is boolean (true or false) to specify whether to maintain the file directory structure. true indicates to keep the file directory.
Rename a function that accepts the matched file name and matches the target location and returns a new target path.
The above is the wildcard support for configuring Grunt tasks and dynamically generating file names.