-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.rb
More file actions
25 lines (18 loc) · 942 Bytes
/
Copy pathrun.rb
File metadata and controls
25 lines (18 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true
# 05 — plain-text
#
# Every transactional/marketing email should ship with a plain-text
# alternative for clients that prefer it (and for spam filters that
# penalize HTML-only mail). The plain_text: true option asks Inky.build
# to derive one from the same source, alongside the HTML.
require_relative "../../bootstrap"
dist = inky_example("05-plain-text")
source = File.read(File.join(__dir__, "digest.inky"))
result = Inky.build(source, base_path: __dir__, plain_text: true)
File.write(File.join(dist, "digest.html"), result.html)
# With plain_text enabled, result.text holds the derived plain-text
# version — the same content, tags and styling stripped, ready to be the
# text/plain part of a multipart email (see send.rb in the repo root).
File.write(File.join(dist, "digest.txt"), result.text)
puts "digest.html: #{result.html.bytesize} bytes"
puts "digest.txt: #{result.text.bytesize} bytes"