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

Unable to use 'media' queries in html templates #536

Open
lazarus-cm opened this issue Nov 14, 2023 · 0 comments
Open

Unable to use 'media' queries in html templates #536

lazarus-cm opened this issue Nov 14, 2023 · 0 comments

Comments

@lazarus-cm
Copy link

lazarus-cm commented Nov 14, 2023

I'm using FluentEmail which has a dependency on RazorLight.
If my email template contains media css queries within style tags I get this exception:

RazorLight.Compilation.TemplateCompilationException: 'Failed to compile generated Razor template: The name 'media' does not exist in the current context

Steps to reproduce the behavior:
Add FluentEmail nuget package.
Add RazorLight package (v .2.3.1)
Use an html template that includes a media query:

@@media only screen and (max-width: 479px) { table[class="wrapper"], tr[class="wrapper"], td[class="wrapper"] { width: 100% !important; max-width: 480px !important; min-width: 320px !important; } }

Call IFluentEmail.UsingTemplate(template, model, true)

Expected behavior
Using a media query (obviously escaped, i.e. @@media should not raise an exception.

Setup

  • OS: Windows 10
  • Platform .Net 8
  • RazorLight version - 2.0.0-rc.3 (via FluentEmail.Razor as a transitive dependency) AND occurs after installing latest version 2.3.1
  • Are you using the OFFICIAL RazorLight package? Yes, see previous line
  • Visual Studio 2022 v17.8 Preview 7.0
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

No branches or pull requests

1 participant