I am using save2png to provide fallback pngs to svg4everybody. The svgs are created and I can change input and output directory. But svg4everybody requires that the pngs are saved with a filename like: "spritesheetname.svg.id.jpg"
At first, I tried some simple things, but I can't even figure out how to change the filename in the first place.
Here is my code:
module.exports = function(grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
svg2png: {
all: {
files: [
// rasterize all SVG files in "img" and its subdirectories to "img/png"
{ cwd: '../img/icons/',
src: ['**/*.svg'],
dest: '../symbol/svg/',
rename: function(dest, src) {
var filename = src.substring(src.lastIndexOf('/'), src.length);
return dest + 'prefix' + filename + '.png';
}
}
]
}
}
});
grunt.registerTask('default', []);
grunt.loadNpmTasks('grunt-svg2png');
};
The pngs are created, but the filename is always the same as the original svg.
I stumbled upon this question, Grunt rename not working, but it was no real help. Flatten and expand just changed the directory structure, but had no influence on the filename.