Skip to content

Commit

Permalink
fix: run removeUnusedCSS only if enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
cossssmin committed Oct 16, 2022
1 parent 4b7db1d commit 33b07b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/transformers/index.js
Expand Up @@ -54,7 +54,7 @@ exports.addURLParams = (html, config) => addURLParams(html, config, true)
exports.preventWidows = (html, config) => preventWidows(html, config)
exports.replaceStrings = (html, config) => replaceStrings(html, config, true)
exports.safeClassNames = (html, config) => safeClassNames(html, config, true)
exports.removeUnusedCSS = (html, config) => removeUnusedCSS(html, config)
exports.removeUnusedCSS = (html, config) => removeUnusedCSS(html, config, true)
exports.removeAttributes = (html, config) => removeAttributes(html, config, true)
exports.attributeToStyle = (html, config) => attributeToStyle(html, config, true)
exports.removeInlineSizes = (html, config) => removeInlineSizes(html, config, true)
Expand Down
8 changes: 6 additions & 2 deletions src/transformers/removeUnusedCss.js
@@ -1,19 +1,23 @@
const {comb} = require('email-comb')
const {get, merge} = require('lodash')

module.exports = async (html, config = {}) => {
module.exports = async (html, config = {}, direct = false) => {
if (get(config, 'removeUnusedCSS') === false) {
return html
}

if (!direct && !get(config, 'removeUnusedCSS')) {
return html
}

const safelist = [
'*body*', // Gmail
'.gmail*', // Gmail
'.apple*', // Apple Mail
'.ios*', // Mail on iOS
'.ox-*', // Open-Xchange
'.outlook*', // Outlook.com
'.ogs*', // Outlook.com
'[data-ogs*', // Outlook.com
'.bloop_container', // Airmail
'.Singleton', // Apple Mail 10
'.unused', // Notes 8
Expand Down

0 comments on commit 33b07b2

Please sign in to comment.