const fs = require('fs'); const path = require('path'); /** * Get and categorize all the animation names and compile * to HTML lists * @param {string} dir - directory containing the css file * @param {string} file - css file name */ function compileAnimationlist(dir = '../source', file = 'animate.css') { const filePath = path.join(__dirname, dir, file); const content = fs.readFileSync(filePath, 'utf8'); const globalRegex = /\/(.*)\w/g; const itemRegex = /(\/)(.*)(\.)/; const rawList = content.match(globalRegex); let currentGroup; let list = {}; rawList.forEach((i) => { const item = i.match(itemRegex); if (item == null) { const title = i.replace('/* ', ''); currentGroup = title; list[title] = []; return currentGroup; } return list[currentGroup].push(item[2]); }, {}); const itemTemplate = (item) => `