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

Create a sprite with the svg from a specific folder #1

Closed
beatrizsmerino opened this issue Oct 17, 2021 · 4 comments
Closed

Create a sprite with the svg from a specific folder #1

beatrizsmerino opened this issue Oct 17, 2021 · 4 comments

Comments

@beatrizsmerino
Copy link

beatrizsmerino commented Oct 17, 2021

Hello! I have a problem that is driving me crazy!

I am using svg-symbol-sprite-loader in a vue project.
I would like the sprite to be created only with the assets/images/icons/svg files.
Apparently I have an svg in the folder assets/fonts/DauphinPlain.
This is giving me an error in the console because it tries to include the font svg in the sprite.

image

image
image

I have read this but I don't know how to do it

image
image

I don't know how to do the regex so that it understands that it should only take the svg from that folder.
/.\/src\/assets\/images\/icons\/svg\/*.svg$/

please can you help me?

@sdvg
Copy link
Owner

sdvg commented Oct 19, 2021

Hello!

Try using the include option on the loader: https://webpack.js.org/configuration/module/#ruleinclude

You can also check this SO answer: https://stackoverflow.com/a/37477010

@beatrizsmerino
Copy link
Author

beatrizsmerino commented Oct 23, 2021

Thanks!!

As I am using chainWebpack I have tried this, I guess it is another way to do the same thing without using the webpack configuration file.
But it is not working

https://stackoverflow.com/questions/57036131/vue-config-js-webpack-4-override-exclude-or-include-of-rule
image
image

@beatrizsmerino
Copy link
Author

@beatrizsmerino
Copy link
Author

beatrizsmerino commented Oct 23, 2021

@sdvg Thanks!!
I have just solved the problem!

https://stackoverflow.com/questions/58391759/adding-svg-loader-to-vue-cli-project-for-a-specific-directory-only
image

image

  1. I include the path to the folder with the svg files that I want in the sprite created with the svg-symbol-sprite-loader package.
  2. And with another package file-loader I include the other svg files that I want to behave as such.

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