index.js
function shouldReplace(svg, cssPath, newCssContent) {
	try {
		fs.accessSync(svg.path, fs.constants ? fs.constants.R_OK : fs.R_OK);
        fs.accessSync(cssPath, fs.constants ? fs.constants.R_OK : fs.R_OK);
	} catch(e) {
		return true;
	}
	const oldSvg = fs.readFileSync(svg.path).toString();
	const newSvg = svg.contents.toString();

    const oldCss = fs.readFileSync(cssPath).toString();

	const svgDifferent = oldSvg !== newSvg; // returns true if new SVG is different
	const cssDifferent = oldCss !== newCssContent; // returns true if new SCSS is different

	// only rerender if svgs or scss are different
    return svgDifferent || cssDifferent ? true : false;
}
function shouldReplace(svg, cssPath, newCssContent) {
	try {
		fs.accessSync(svg.path, fs.constants ? fs.constants.R_OK : fs.R_OK);
        fs.accessSync(cssPath, fs.constants ? fs.constants.R_OK : fs.R_OK);
	} catch(e) {
		return true;
	}
	const oldSvg = fs.readFileSync(svg.path).toString();
	const newSvg = svg.contents.toString();

    const oldCss = fs.readFileSync(cssPath).toString();

	const svgDifferent = oldSvg !== newSvg; // returns true if new SVG is different
	const cssDifferent = oldCss !== newCssContent; // returns true if new SCSS is different

	// only rerender if svgs or scss are different
    return svgDifferent || cssDifferent ? true : false;
}
function shouldReplace ( svg , cssPath , newCssContent ) { try { fs . accessSync ( svg . path , fs . constants ? fs . constants . R_OK : fs . R_OK ) ; fs . accessSync ( cssPath , fs . constants ? fs . constants . R_OK : fs . R_OK ) ; } catch ( e ) { return true ; } const oldSvg = fs . readFileSync ( svg . path ) . toString ( ) ; const newSvg = svg . contents . toString ( ) ; const oldCss = fs . readFileSync ( cssPath ) . toString ( ) ; const svgDifferent = oldSvg !== newSvg ; // returns true if new SVG is different const cssDifferent = oldCss !== newCssContent ; // returns true if new SCSS is different // only rerender if svgs or scss are different return svgDifferent || cssDifferent ? true : false ; }
checks if a recompilation is necessary
checks if a recompilation is necessary