Add hook to optimize staged SVGs before commit (#166)
This commit is contained in:
committed by
GitHub
parent
4352e985df
commit
3bedf3ba36
10
scripts/optimizeStagedSvgs.js
Normal file
10
scripts/optimizeStagedSvgs.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import fs from 'fs';
|
||||
import processSvg from './render/processSvg';
|
||||
|
||||
const svgFiles = process.argv.slice(4);
|
||||
|
||||
svgFiles.forEach(async svgFile => {
|
||||
const content = fs.readFileSync(svgFile);
|
||||
const svg = await processSvg(content);
|
||||
fs.writeFileSync(svgFile, svg, 'utf-8');
|
||||
});
|
||||
Reference in New Issue
Block a user