parse fails when parsing style tag
See original GitHub issueWe’ve got an svg that looks kind of like this:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style>
.clipped-thing {
clip-path: url(#clip-path);
}
</style>
<clipPath id="clip-path">
<rect y="-0.86" width="375" height="177"/>
</clipPath>
</defs>
<g class="clipped-thing">
<!-- SOME SVG STUFF -->
</g>
</svg>
loading this svg fails with: Module build failed: SyntaxError: unknown: Unexpected token
on clip-path: url(#clip-path);
Issue Analytics
- State:
- Created 7 years ago
- Reactions:8
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Common CSS Parser Errors (Parsing Errors Found)
The parser will show a Parse Error and the line number if it detects something that does not meet the requirements. CSS Parser...
Read more >How to fix: CSS: Parse Error. - Rocket Validator
CSS styles could not be parsed, check the indicated line to find what caused the parser to fail. Common causes are unclosed curly...
Read more >JSON.parse throws error when parsing JSON that has HTML ...
I have the following code that I'm trying to use and I keep getting an error on the JSON parser
Read more >CSS Parse Error: The Ultimate Guide To Eradicating Them
Parse error in CSS occurs when a style sheet departs from the precise CSS parser requirements; Common causes include missing a semicolon, curly...
Read more >13.2 Parsing HTML documents - HTML Standard - WhatWG
This error occurs if the parser encounters a start tag for an element that is not in the list of void elements or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It seems to work for me - https://github.com/boopathi/react-svg-loader/commit/1bb152ef6871511198d8f221271a9783449729c6#diff-9bb3de20ef60fb0751fb0025b2cd27eaR22 . It removes the style tags from the svgs.
Oh, sorry, I have used webpack 2.x config instead of webpack 1.x. Now everything works properly. So for this issue I suggest to use svgo config with removeStyleElement: true