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

Inline SVGs with no styles when build/generate #61

Open
mickaelchanrion opened this issue Oct 14, 2020 · 3 comments
Open

Inline SVGs with no styles when build/generate #61

mickaelchanrion opened this issue Oct 14, 2020 · 3 comments

Comments

@mickaelchanrion
Copy link

Hi!
When using vue-svg-loader (?inline), if the svg file contains <style> in the defs, then it will apparently be ignored and the svg will be with no style once the Nuxt app is built/generated.

Issue #24 was about that problem and it is now closed, yet I think no effective solution has been provided so far.
So ok, we can use the raw-loader but still, the original problem remains hence a new issue.

In a project, I ended up fixing that issue by replacing the loader by svg-to-vue-component:

function setup(config, options = {}) {
  // ...
  const rule = {
    test: /\.svg$/i,
    oneOf: [
      {
        resourceQuery: /inline/,
        use: [
          'vue-loader',
          {
            loader: 'svg-to-vue-component/loader',
            options: options.inline,
          }
        ],
  // ...

It seems to be working well. Should I open a PR?

@sam3d
Copy link
Collaborator

sam3d commented Oct 14, 2020

I'll happily accept a PR! Please could it use a resourceQuery of /component/? Thank you 😄

@mickaelchanrion
Copy link
Author

Ok so I keep the inline one?

@sam3d
Copy link
Collaborator

sam3d commented Oct 14, 2020 via email

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

2 participants