From 4a24a9bddb9e5febec81092ca485b62396c6a369 Mon Sep 17 00:00:00 2001 From: Cosmin Popovici Date: Sat, 28 Sep 2024 15:26:38 +0300 Subject: [PATCH] refactor: transformer order css.purge should run after posthtml-mso, so that it can actually remove outlook comments --- src/transformers/index.js | 50 +++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/transformers/index.js b/src/transformers/index.js index a3d4d567..99604a02 100644 --- a/src/transformers/index.js +++ b/src/transformers/index.js @@ -124,16 +124,7 @@ export async function run(html = '', config = {}) { } /** - * 8. Purge CSS - * - * Remove unused CSS, uglify classes etc. - */ - if (get(config, 'css.purge')) { - posthtmlPlugins.push(comb(config.css.purge)) - } - - /** - * 9. Remove attributes + * 8. Remove attributes * * Remove attributes from HTML tags * If `undefined`, removes empty `style` and `class` attributes @@ -148,7 +139,7 @@ export async function run(html = '', config = {}) { } /** - * 10. Shorthand CSS + * 9. Shorthand CSS * * Convert longhand CSS properties to shorthand in `style` attributes. */ @@ -159,7 +150,7 @@ export async function run(html = '', config = {}) { } /** - * 11. Add attributes + * 10. Add attributes * * Add attributes to HTML tags. */ @@ -170,7 +161,7 @@ export async function run(html = '', config = {}) { } /** - * 12. Base URL + * 11. Base URL * * Add a base URL to relative paths. */ @@ -181,7 +172,7 @@ export async function run(html = '', config = {}) { } /** - * 13. URL parameters + * 12. URL parameters * * Add parameters to URLs. */ @@ -192,7 +183,7 @@ export async function run(html = '', config = {}) { } /** - * 14. Six-digit HEX + * 13. Six-digit HEX * * Enabled by default, converts three-digit HEX colors to six-digit. */ @@ -203,7 +194,7 @@ export async function run(html = '', config = {}) { } /** - * 15. PostHTML MSO + * 14. PostHTML MSO * * Enabled by default, simplifies writing MSO conditionals for Outlook. */ @@ -214,7 +205,23 @@ export async function run(html = '', config = {}) { } /** - * 16. Prettify + * 15. Purge CSS + * + * Remove unused CSS, uglify classes etc. + */ + if (get(config, 'css.purge')) { + posthtmlPlugins.push(comb(config.css.purge)) + } + + /** + * 16.