Files
doormile-site/find_mismatches.js
2026-04-17 12:47:41 +05:30

38 lines
1.3 KiB
JavaScript

const fs = require('fs');
const path = require('path');
const cssDir = 'c:/xampp/htdocs/doormileweb/assets/css';
const file = 'theme.css';
const filePath = path.join(cssDir, file);
const content = fs.readFileSync(filePath, 'utf8');
// Match rules
// This is a bit complex as we need to find the rule block.
// We'll simplify: look for blocks with font-family and content.
const rules = content.split('}');
rules.forEach(rule => {
if (rule.includes('content:') && rule.includes('font-family:')) {
const contentMatch = rule.match(/content:\s*['"]\\([ef][a-f0-9]+)['"]/i);
const fontMatch = rule.match(/font-family:\s*['"]?([^'";]+)['"]?/i);
if (contentMatch && fontMatch) {
const hex = contentMatch[1].toLowerCase();
const family = fontMatch[1];
// e... is usually fontello
if (hex.startsWith('e') && (family.includes('Font Awesome') || family.includes('fa-'))) {
console.log(`MISMATCH: ${hex} with ${family}`);
console.log(rule.trim());
}
// f... is usually font awesome
if (hex.startsWith('f') && family.includes('fontello')) {
console.log(`MISMATCH: ${hex} with ${family}`);
console.log(rule.trim());
}
}
}
});