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

add function to minify the email's HTML/CSS #86

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

salim-b
Copy link
Contributor

@salim-b salim-b commented Oct 16, 2019

The minification relies on the binary minify which is cross-platform and works on Windows, macOS, Linux and BSD. It is based on the same Golang library the static site generator Hugo uses for minification.

Pre-built minify binaries can be downloaded from here.
Alternatively, instructions to build minify from source are available here.

The test message created by prepare_test_message() was shrunk by about 33 % (from 10.3 to 7.7 KiB) by minification.

If desired, we could also apply minify() directly in compose_email(). Currently it's designed to be used in a pipeline like this:

library(blastula)

prepare_test_message() %>%
  minify() %>%
  smtp_send()

Addendum: I took the liberty of adding myself as a package author contributor in this PR.

The [minification](https://en.wikipedia.org/wiki/Minification_(programming))
relies on the binary [**minify**](https://github.com/tdewolff/minify/tree/master/cmd/minify)
which is cross-platform and works on Windows, macOS, Linux and BSD. It is based on the same
Golang library [the static site generator Hugo uses for minification](gohugoio/hugo#1251).

Pre-built minify binaries can be downloaded from [here](https://github.com/tdewolff/minify/releases).
Alternatively, instructions to build minify from source are available [here](https://github.com/tdewolff/minify/tree/master/cmd/minify#installation).

The test message created by `prepare_test_message()` was shrunk from 12.4 KiB to 9.1 KiB by minification (message sent as inline attachment).
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.

1 participant