forked from johannesjo/super-productivity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove-woff.js
24 lines (21 loc) · 922 Bytes
/
remove-woff.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* 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);
// });
// });