@@ -332,7 +332,16 @@ grunt.initConfig({
332
332
333
333
grunt . registerMultiTask ( "copy" , "Copy files to destination folder and replace @VERSION with pkg.version" , function ( ) {
334
334
function replaceVersion ( source ) {
335
- return source . replace ( "@VERSION" , grunt . config ( "pkg.version" ) ) ;
335
+ return source . replace ( / @ V E R S I O N / g, grunt . config ( "pkg.version" ) ) ;
336
+ }
337
+ function copyFile ( src , dest ) {
338
+ if ( / ( j s | c s s ) $ / . test ( src ) ) {
339
+ grunt . file . copy ( src , dest , {
340
+ process : replaceVersion
341
+ } ) ;
342
+ } else {
343
+ grunt . file . copy ( src , dest ) ;
344
+ }
336
345
}
337
346
var files = grunt . file . expandFiles ( this . file . src ) ;
338
347
var target = this . file . dest + "/" ;
@@ -342,19 +351,13 @@ grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @
342
351
}
343
352
files . forEach ( function ( fileName ) {
344
353
var targetFile = strip ? fileName . replace ( strip , "" ) : fileName ;
345
- if ( / ( j s | c s s ) $ / . test ( fileName ) ) {
346
- grunt . file . copy ( fileName , target + targetFile , {
347
- process : replaceVersion
348
- } ) ;
349
- } else {
350
- grunt . file . copy ( fileName , target + targetFile ) ;
351
- }
354
+ copyFile ( fileName , target + targetFile ) ;
352
355
} ) ;
353
356
grunt . log . writeln ( "Copied " + files . length + " files." ) ;
354
357
var renameCount = 0 ;
355
358
for ( var fileName in this . data . renames ) {
356
359
renameCount += 1 ;
357
- grunt . file . copy ( fileName , target + grunt . template . process ( this . data . renames [ fileName ] , grunt . config ( ) ) ) ;
360
+ copyFile ( fileName , target + grunt . template . process ( this . data . renames [ fileName ] , grunt . config ( ) ) ) ;
358
361
}
359
362
if ( renameCount ) {
360
363
grunt . log . writeln ( "Renamed " + renameCount + " files." ) ;
0 commit comments