feat(postcard): inline mail CSS at render with a per-layout opt-out
- github.com/vanng822/go-premailer v1.38.0 (default options) inlines the rendered HTML after the safety checks; the result is checked again, HTML without a style element is left as it is, an inliner error sends the style block only and warns (key inline:<layout>) - opt-out: layout header key disable_auto_inline_css, the layouts column of the same name (migration 202611130003), LayoutFile/LayoutOverride/ Draft.DisableAutoInlineCSS; SyncIndex mirrors and ResetOverride restores the file's value - cabana layout form switch on the CSS tab, mapped into the layout draft and the save validation; en/pl copy - tests: TestMailPartialsSmoke/inline, TestMailEditorSmoke/inline_flag, the layouts switch in TestMailScreensSmoke; CSS-slot tests read the style block through a no-op inliner - 35-06 Task 2 (G-35-8)
This commit is contained in:
@@ -44,6 +44,8 @@ type Draft struct {
|
||||
HTML string
|
||||
Text string
|
||||
CSS string
|
||||
// DisableAutoInlineCSS is a layout draft's opt-out of CSS inlining.
|
||||
DisableAutoInlineCSS bool
|
||||
|
||||
// Brand is a branding draft. Nil is the default brand.
|
||||
Brand *Brand
|
||||
@@ -261,7 +263,7 @@ func (e *Editor) renderLayout(d Draft, ov Overrides, opts renderOptions) (Render
|
||||
for k, v := range ov.Layouts {
|
||||
layouts[k] = v
|
||||
}
|
||||
layouts[code] = LayoutOverride{Name: code, HTML: d.HTML, Text: d.Text, CSS: d.CSS}
|
||||
layouts[code] = LayoutOverride{Name: code, HTML: d.HTML, Text: d.Text, CSS: d.CSS, DisableAutoInlineCSS: d.DisableAutoInlineCSS}
|
||||
ov.Layouts = layouts
|
||||
opts.overrides = ov
|
||||
sample := sampleMessage()
|
||||
|
||||
Reference in New Issue
Block a user