const fs = require('fs');
const path = require('path');
const dir = __dirname;
const files = fs.readdirSync(dir).filter(f => f.endsWith('.html'));
const headInject = `\n \n `;
const bodyInject = `\n \n
`;
const scriptInject = `\n \n \n`;
files.forEach(file => {
let content = fs.readFileSync(path.join(dir, file), 'utf8');
let changed = false;
if (!content.includes('aos.css')) {
content = content.replace('', headInject + '\n');
changed = true;
}
if (!content.includes('global-preloader')) {
content = content.replace(/]*>/, match => match + bodyInject);
changed = true;
}
if (!content.includes('aos.js')) {
content = content.replace('', scriptInject + '