'; + output += '
'; // Loop over tags and snippets to create the list of snippets - for (let tag of [...new Set(Object.entries(tagDbData).map(t => t[1][0]))] - .filter(v => v) - .sort( - (a, b) => - util.capitalize(a, true) === 'Uncategorized' - ? 1 - : util.capitalize(b, true) === 'Uncategorized' - ? -1 - : a.localeCompare(b) - )) { + for (let tag of taggedData) { let localOutput = output .replace(/\$tag/g, util.capitalize(tag)) .replace(new RegExp(`./${tag}#`, 'g'), '#'); @@ -218,22 +220,7 @@ try { } // Minify output pagesOutput.forEach(page => { - page.content = minify(page.content, { - collapseBooleanAttributes: true, - collapseWhitespace: true, - decodeEntities: false, - minifyCSS: true, - minifyJS: true, - keepClosingSlash: true, - processConditionalComments: true, - removeAttributeQuotes: false, - removeComments: true, - removeEmptyAttributes: false, - removeOptionalTags: false, - removeScriptTypeAttributes: false, - removeStyleLinkTypeAttributes: false, - trimCustomFragments: true - }); + page.content = minifyHTML(page.content); fs.writeFileSync( path.join(docsPath, (page.tag === 'array' ? 'index' : page.tag) + '.html'), page.content @@ -312,22 +299,7 @@ try { archivedOutput += `${archivedEndPart}`; // Generate and minify 'archive.html' file - const minifiedArchivedOutput = minify(archivedOutput, { - collapseBooleanAttributes: true, - collapseWhitespace: true, - decodeEntities: false, - minifyCSS: true, - minifyJS: true, - keepClosingSlash: true, - processConditionalComments: true, - removeAttributeQuotes: false, - removeComments: true, - removeEmptyAttributes: false, - removeOptionalTags: false, - removeScriptTypeAttributes: false, - removeStyleLinkTypeAttributes: false, - trimCustomFragments: true - }); + const minifiedArchivedOutput = minifyHTML(archivedOutput); fs.writeFileSync(path.join(docsPath, 'archive.html'), minifiedArchivedOutput); console.log(`${chalk.green('SUCCESS!')} archive.html file generated!`); @@ -364,22 +336,7 @@ try { glossaryOutput += `${glossaryEndPart}`; // Generate and minify 'glossary.html' file - const minifiedGlossaryOutput = minify(glossaryOutput, { - collapseBooleanAttributes: true, - collapseWhitespace: true, - decodeEntities: false, - minifyCSS: true, - minifyJS: true, - keepClosingSlash: true, - processConditionalComments: true, - removeAttributeQuotes: false, - removeComments: true, - removeEmptyAttributes: false, - removeOptionalTags: false, - removeScriptTypeAttributes: false, - removeStyleLinkTypeAttributes: false, - trimCustomFragments: true - }); + const minifiedGlossaryOutput = minifyHTML(glossaryOutput); fs.writeFileSync(path.join(docsPath, 'glossary.html'), minifiedGlossaryOutput); console.log(`${chalk.green('SUCCESS!')} glossary.html file generated!`);