Automattic / juice

Juice inlines CSS stylesheets into your HTML source.
MIT License
3.12k stars 221 forks source link

juice.codeBlocks does not get removed by webpack #450

Closed robin-ray closed 1 year ago

robin-ray commented 1 year ago

Hello!

Summary

Set juiceClient.codeBlocks = cheerio.codeBlocks in /lib/client.js instead of /index.js so that it gets emitted by webpack. I also removed some assignments in /index.js that should already exist because juice = juiceClient.

Motivation

Webpack does not emit juice.codeBlocks = juiceClient.codeBlocks (or any of the other assignments in /index.js). This breaks codeBlocks when using juice in the browser via mjml-browser (see https://github.com/mjmlio/mjml/issues/2653). Assigning codeBlocks in /lib/client.js instead of /index.js fixes the issue when testing locally via npm link.

Thanks for considering my PR!