-
Notifications
You must be signed in to change notification settings - Fork 33
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
Invalid markup generated when combined with html-loader #126
Comments
I see your point. |
Hi :-) Yeah I've dug into this some more, and I think the real issue here is that As such I've filed webpack-contrib/css-loader#615, and hopefully once that's fixed, |
Hi @bhovhannes, I believe the issue is fixed in Thank you for your work on the plugin! |
@ubnt-marc-khouri I have to check if everything works fine with the new recent version of css-loader and Not sure if I'll have a time for open-source this days, but I'll work on that at some point during next week. |
BREAKING CHANGE: `noquotes` loader option has been removed. See #126 for more details and rationale behind that change.
Apparently, this seems not to work, cause somehow something swallows surrounding quotes of single valued attributes, such for example See this project sample at commit 2b81598, what has html-loader and svg-url-loader. If you inspect the template <img id="logo" src="../assets/img/spinner.svg" alt="Loading"> After building, the output <img id=logo src=data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='
Some may say this is a bug from svg-url-loader, but the ugly truth is that you may disable svg-url-loader and the quotes still disappear. |
As a possible workaround, setting |
Summary:
For SVG URLs used in HTML (eg via a template loaded via
html-loader
byHtmlWebpackPlugin
), superfluous quotes are added to the HTML markup, that break rendering in the browser. Whilstsvg-url-loader
has anoquotes
option, I wouldn't have expected to have to use it for this use-case given that it's supported natively byurl-loader
.STR:
Run
yarn install && yarn webpack
using node 8.5.0 and this test project:package.json
webpack.config.js
src/index.html
src/test.svg
src/index.js
// Empty file
Expected:
That svg-url-loader acts as a drop in replacement for url-loader (or if that's not intended, then this ideally would be made clearer in the README).
ie: The resultant
dist/index.html
should still:Actual:
The resultant
dist/index.html
:alt
text)The generated file contents:
Compared to the output when
svg-url-loader
is replaced byurl-loader
inwebpack.config.js
:Modifying both
svg-url-loader
andurl-loader
locally, addingconsole.log()
calls to show the raw string being returned by each loader, gives...svg-url-loader
:url-loader
:The text was updated successfully, but these errors were encountered: