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

AttributeError: 'CSSMediaRule' object has no attribute 'style' #290

Open
Rijoanul-Shanto opened this issue May 3, 2023 · 0 comments
Open

Comments

@Rijoanul-Shanto
Copy link

Rijoanul-Shanto commented May 3, 2023

Having trouble with the following transformation:

<style type="text/css">
    @media (prefers-color-scheme: dark) {

      .textPrimary {
        color: #E2E2E2 !important;
      }

      @media (max-width: 630px) {

        body,
        .footerContainer {
          background-color: #1E1E1E !important;
        }
      }
    }
  </style>

html = instance.transform(html, pretty_print=False)
  
File "/usr/local/lib/python3.10/dist-packages/premailer/premailer.py", line 414, in transform
    style.text = self._css_rules_to_string(these_leftover)
  File "/usr/local/lib/python3.10/dist-packages/premailer/premailer.py", line 683, in _css_rules_to_string
    for key in rule.style.keys():
AttributeError: 'CSSMediaRule' object has no attribute 'style'. Did you mean: '_type'?
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