lib/output/modifiers/svgToImg.js
function svgToImg(baseFolder, currentFile, $) {
    var currentDirectory = path.dirname(currentFile);

    return editHTMLElement($, 'svg', function($svg) {
        var content = '<?xml version="1.0" encoding="UTF-8"?>' +
            renderDOM($, $svg);

        // We avoid generating twice the same PNG
        var hash = crc.crc32(content).toString(16);
        var fileName = hash + '.svg';
        var filePath = path.join(baseFolder, fileName);

        // Write the svg to the file
        return fs.assertFile(filePath, function() {
            return fs.writeFile(filePath, content, 'utf8');
        })

        // Return as image
        .then(function() {
            var src = LocationUtils.relative(currentDirectory, fileName);
            $svg.replaceWith('<img src="' + src + '" />');
        });
    });
}
function svgToImg(baseFolder, currentFile, $) {
    var currentDirectory = path.dirname(currentFile);

    return editHTMLElement($, 'svg', function($svg) {
        var content = '<?xml version="1.0" encoding="UTF-8"?>' +
            renderDOM($, $svg);

        // We avoid generating twice the same PNG
        var hash = crc.crc32(content).toString(16);
        var fileName = hash + '.svg';
        var filePath = path.join(baseFolder, fileName);

        // Write the svg to the file
        return fs.assertFile(filePath, function() {
            return fs.writeFile(filePath, content, 'utf8');
        })

        // Return as image
        .then(function() {
            var src = LocationUtils.relative(currentDirectory, fileName);
            $svg.replaceWith('<img src="' + src + '" />');
        });
    });
}
function svgToImg ( baseFolder , currentFile , $ ) { var currentDirectory = path . dirname ( currentFile ) ; return editHTMLElement ( $ , 'svg' , function ( $svg ) { var content = '<?xml version="1.0" encoding="UTF-8"?>' + renderDOM ( $ , $svg ) ; // We avoid generating twice the same PNG var hash = crc . crc32 ( content ) . toString ( 16 ) ; var fileName = hash + '.svg' ; var filePath = path . join ( baseFolder , fileName ) ; // Write the svg to the file return fs . assertFile ( filePath , function ( ) { return fs . writeFile ( filePath , content , 'utf8' ) ; } ) // Return as image . then ( function ( ) { var src = LocationUtils . relative ( currentDirectory , fileName ) ; $svg . replaceWith ( '<img src="' + src + '" />' ) ; } ) ; } ) ; }
Replace SVG tag by IMG

@param {String} baseFolder
@param {HTMLDom} $
Replace SVG tag by IMG