super-productivity/tools/remove-woff.js
2021-06-15 21:30:29 +02:00

24 lines
922 B
JavaScript

/* eslint-env es6 */
const glob = require('glob');
const fs = require('fs');
// "removeWOFF2": "find dist/ -type f -iname '*.woff' -delete && find dist/ -type f -iname '*.css' -exec sed -i \"s/, url\\('.*'\\) format\\('woff'\\)//g\" {} \\;",
glob('dist/*.woff', function (er, files) {
files.forEach((filePath) => {
fs.unlinkSync(filePath);
});
});
// NOTE: this would remove the dead references, but it should be no problem anyway
// glob('dist/*.css', function (er, files) {
// files.forEach((filePath) => {
// const fileContent = fs.readFileSync(filePath, { encoding: 'utf8' });
// const newFileContent = fileContent
// .replace(/,url\(.*\) format\('woff'\)/g, '')
// .replace(/,url\(.*\) format\("woff"\)/g, '')
// .replace(/url\(.*\) format\('woff'\)/g, '')
// .replace(/url\(.*\) format\("woff"\)/g, '');
// fs.writeFileSync(filePath, newFileContent);
// });
// });