Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: allow overriding email comb selector safelist #975

Merged
merged 1 commit into from Apr 13, 2023

Conversation

cossssmin
Copy link
Member

This PR changes the way removeUnusedCSS behaves, allowing you to completely override its selectors safelist from your config.js. This was necessary so that email client targeting selectors do not show up in all of your project's templates when you just want to use a one-off. They would normally show up because Tailwind CSS is compiled once for all templates, and then is purged on a template-basis.

Maizzle won't remove these selectors in the first pass, but with this change you can now run a quick second pass to remove unnecessary client targeting selectors from templates that don't need them:

// config.production.js

const {removeUnusedCSS} = require('@maizzle/framework')

module.exports = {
  // ...
  events: {
	// Run removeUnusedCSS again, this time overriding the `whitelist` option so that no email client targeting selector is preserved
    afterTransformers(html) {
      return removeUnusedCSS(html, {
        whitelist: [],
      })
    }
  }
}

@cossssmin cossssmin merged commit 4224c9e into master Apr 13, 2023
3 checks passed
@cossssmin cossssmin deleted the refactor/email-comb branch April 13, 2023 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant