Skip to content

Commit

Permalink
Add stripping of @charset lines
Browse files Browse the repository at this point in the history
  • Loading branch information
backspace committed Nov 19, 2023
1 parent a2229a6 commit 3a73ed1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/premailex/css_parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ defmodule Premailex.CSSParser do
)/ix
@comments ~r/\/\*[\s\S]*?\*\//m
@media_queries ~r/@media[^{]+{([\s\S]+?})\s*}/mi
@charset_rules ~r/^\s*@charset .*;$/mi
@font_face ~r/@font-face\s*{[\s\S]+?}/mi

@doc """
Expand Down Expand Up @@ -123,6 +124,7 @@ defmodule Premailex.CSSParser do
string
|> String.replace(@font_face, "")
|> String.replace(@media_queries, "")
|> String.replace(@charset_rules, "")
|> String.replace(@comments, "")
end

Expand Down

0 comments on commit 3a73ed1

Please sign in to comment.