javascript - Grunt-contrib-copy: variables within the rename function -


i have following copy task in gruntfile.js

copy: {         css: {             expand: true,                   cwd: 'min/css',               src: 'theme_<%= props.majorversion %>.<%= props.minorversion %>.min.css',                       dest: 'dest/dir/',             rename: function(dest, src) {                 return dest + src.replace('_<%= props.majorversion %>.<%= props.minorversion %>','');             }         }     } 

currently, file copied once copied, i'd remove version numbers make part of file name.

they defined earlier in gruntfile , working expected until rename function.

current file_1.123.css , i'd end file.css.

i've tried various different ways pass variables rename function without success.

thanks.

try substring instead:

rename: function(dest, src) {            return dest + src.substring(0, src.indexof('_')) + '.css';         }  

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -