Description
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