8000 Unable to use 'media' queries in html templates · Issue #536 · toddams/RazorLight · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Unable to use 'media' queries in html templates #536
Open
@lazarus-cm

Description

@lazarus-cm

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0