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
Post a Comment