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

[Feature]: add support for generator.dataUrl as a function in loader config #5640

Closed
SkReD opened this issue Feb 7, 2024 · 3 comments · Fixed by #5841
Closed

[Feature]: add support for generator.dataUrl as a function in loader config #5640

SkReD opened this issue Feb 7, 2024 · 3 comments · Fixed by #5841
Assignees
Labels
feat New feature or request PR welcome

Comments

@SkReD
Copy link

SkReD commented Feb 7, 2024

What problem does this feature solve?

Allow to generate more optimized base64 representation of svg. Used like so

import svgToMiniDataURI from 'mini-svg-data-uri'

{
    test: /\.svg$/,
    issuer: /\.css$/,
    type: 'asset',
    parser: {
      dataUrlCondition: {
        maxSize: 2048,
      },
    },
    generator: {
      dataUrl: (content: string) => svgToMiniDataURI(content),
    },
  },
}  

What does the proposed API of configuration look like?

https://webpack.js.org/configuration/module/#rulegeneratordataurl

@SkReD SkReD added feat New feature or request pending triage The issue/PR is currently untouched. labels Feb 7, 2024
@jerrykingxyz jerrykingxyz removed the pending triage The issue/PR is currently untouched. label Feb 19, 2024
@luhc228
Copy link
Contributor

luhc228 commented Feb 27, 2024

Can I have a try?

@xc2
Copy link
Collaborator

xc2 commented Feb 27, 2024

Can I have a try?

@jerrykingxyz hi, has anyone been working on this?

@hardfist
Copy link
Contributor

@luhc228 thanks in advance
/assign @luhc228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request PR welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants