Skip to content

Usage with the inline_css Twig component? #66

@GenieTim

Description

@GenieTim

With the new Symfony Mime Component, in Symfony 4.3 experimental, it becomes accepted practice to make e-Mails with Twig. E-Mails require inline CSS, which is achieved thanks to an inline_css filter. Is there a recommended way on how to use webpack encore generated assets with the inline_css filter?

I see two possibilities as for the current possibilities (am I missing one, is one coming ahead?):

  1. Limit the email's css to one output file using some configuration, add a twig namespace linking to the output directory and then using something like inline_css(source(encore_entry_css_files("my-email-entry")|first))
  2. Use a simple { filter inline_css } without opening the source, and dumping the source ourselfs into a <style> inside the filter. This way, we can have the loop {% for css_loc in encore_entry_css_files("my-email-entry") %}{{ source("@myBuildNamespace" ~ css_loc) }}{% endfor %} and therefore more than one output file. This case would be a further use case for [RFC] Inline assets #16

Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions