-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Option to generate unique IDs? #674
Comments
Actually, cleanupIDs has |
I, too, need this feature. the cleanupIDs |
The prefix should be the name of the file. For example: IconOfACar.svg -> iconofacar_id1 |
Being able to supply the prefix should suffice. Seems more versatile than having SVGO pick one automagically. |
I don't think that is versatile for batch processing. I usually process thousands of svg files with a script at every site update, and I surely don't want to manually enter a prefix for each one. |
Similar issue?: #673 |
Is there any movement on this? As much as it sounds a dick move, I think you need to go with a general consensus here, this is an issue that many users are having when using inlined SVGs when passed through SVGO - for example we even have this issue using Sketch SVGO Compressor plugin, we end up having 10 SVGs with As @Emasoft has suggested, I think the only sensible solution would be to slugify the filename and use that as the id prefix, turn this on as a default, which means every user that has an automated workflow or has tools that then use svgo will be unaffected, unless they pass in an extra option to disable it something like @strarsis this does seem like similar issue yeah, I think the issue as a whole is just around "naming conflicts as the minification process has no concept of other files" |
PR for a plugin that does this - a bit tweaking is necessary though: #700 |
@OwenMelbz you can disable minifying IDs in cleanupIDs with the following config: plugins:
- cleanupIDs:
minify: false So your files will have unique IDs as long as they had it already. Editing a bunch of files has nothing with optimization, so it lays out of SVGO's scope. |
@GreLI You've completely missed the point - which clearly several other people have agreed there is an issue. Many automated systems rely on svgo e.g Sketch has a official plugin, SVGO Compressor, which uses svgo. Its extremely narrow minded and selfish to disregard an issue simply because you don't want to address it, rather than helping the global community come up with a solution to a community acknowledged issue. Maybe if we state the problem again you will understand. SVGO when cleaning up IDs (a feature that is still desired) does not have a concept of "other svgs" - which means if you minified 100 svgs, they would all end up having the id of The solution to help developers/designers/content writers/PEOPLE is by using the privileged stance of svgos positioning in the development world to implement a feature that solves this issue for users who are using their system for some reason. And there have been plenty of suggestions on ways to solve this. Remember when Facebook - a social media platform, decided to use its privileged position to help family members involved in world crises to mark theirselves as safe? Yes its not directly their problem to solve, but they could propose a solution because it was for the benefit of its users. This is why people come to you guys seeking solutions, because you're in a position to help out. Similarly to the cheesy line from spider-man - with great power comes great responsibility. Maybe thinking of it in a different non-dismissive Trump-like manor will urge you not to slap a "closed" on a real life issue. |
Unfortunately, nobody here can't fix their obvious flaws. What if different users want totally opposite? Configuration is what makes SVGO flexible. Ask these systems authors to add an option to set a configuration. They get paid for this, unlike me or other OSS maintainers. The “consensus“ here has been set just in your mind. No statistics or clear numbers has been provided to verify your claims. So please stop your nonsense word pouring. Nobody here has to do something for you. Don't make me block conversation. |
This comment has been minimized.
This comment has been minimized.
As you wish. |
@pluma @Kraxxis @Emasoft @OwenMelbz I think @GreLI 's right about the usage and purpose of SVGO. But asking for a feature like this is reasonable. SVGO provides a fairly easy way to manipulate svg code. it just seems very natural to do this kind of stuff with SVGO. I ended up with writing a node script to process all the svg files using svgo. the tricky part is, every time it process a file, it will use a new SVGO instance and use a config with unique prefix. something look like this: let filePath = path.join(folderPath, file)
let prefix = generatePrefix(file)
let svgo = new SVGO({
plugins: [{cleanupIDs: {
prefix: prefix
}}]
})
svgo.optimize(fs.readFileSync(filePath, 'utf8'), svg => {
result = svg.data
}) the generatePrefix function will generate a string use file's name. |
The gulp-svgmin have solution for thus problem. |
I've found a solution for anyone is using webpack and svgo-loader or react-svg-loader that will pass a unique deterministic ID prefix to svgo for each file. This should generate the same IDs across different build environments. // webpack.config.js
const hash = require('string-hash');
const {relative} = require('path');
const context = __dirname;
module.exports = {
module: {
rules: [
{
test: /\.svg$/,
use: ({resource}) => ({
loader: 'svgo-loader',
options: {
plugins: [
{cleanupIDs: {
prefix: `svg${hash(relative(context, resource))}`,
}},
],
},
}),
},
],
},
}; |
I found a workaround to this problem. {
cleanupIDs: {
prefix: {
toString() {
this.counter = this.counter || 0;
return `id-${this.counter++}`;
}
}
}
} JavaScript objects invokes |
Hi @GreLI . It's sad to see the abuse you got on this issue 😞
Wouldn't it be within SVGO's scope to not break things while optimising? |
I agree, this shouldn't require workarounds from every consumer and client utilizing SVGO. Out of the box, SVGO's CLI is able to optimize multiple files at once, but the files are effectively broken when they come out due to colliding ids. If nothing else, it'd cut down on the duplicate issues about it. 😉 |
I was curious if anyone can provide an example of an id conflict. I'm very interested in using SVGO but want to make sure that I'm not wading into problems. |
If anyone happens to wonder how to fix broken IDs, go to the following comment: |
2 @mattkime |
Anyone who encounters this whilst using |
If anyone is using svg-react-loader, I have created a fix here: https://github.com/SilverFox70/svg-react-loader and it is simple as adding a |
This library solves the problem, thanks so much @laleksiunas ! I submitted a feature request to have the babel plugin uniquify top-level SVG nodes as well, which would reduce the need to use the hook in most of our cases, when used in combination with SVGO's For others stuck on this problem I'd steer you away from trying to solve it at any SVGO config or custom plugin level since SVGO extends Webpack's processing of each SVG asset, not individual per-page import cases, so you're going to need something like @laleksiunas 's inline-svg-unique-id Babel plugin. https://github.com/laleksiunas/inline-svg-unique-id |
And just a side note, how strange to learn that multiple SVGs in web pages are so problematic, both in their internal reference collisions, such as clip paths, and also as a general a11y/ Accessibility problem, where every element on a page is expected to have a unique id: https://www.w3.org/WAI/standards-guidelines/act/rules/id-value-unique-3ea0c8/. Considering this is such a general need that addresses so many developers across all frameworks, it seems like it should be addressed at a more fundamental level. Either by a great, widely-used library like SVGO if that's feasible, or some other way. Just sort of flabbergasted each time I discover one of these built-in problems with using the DOM for modern websites. Does anyone know of any W3C-level proposals or solutions emerging in this problem space? If so please reply here, thanks! |
@mosesoak: You can use First I thought
|
@strarsis Thanks for the reply. Yes, we did solve almost everything with SVGO alone -- except the need to uniquify the ids of two of the same instances of a single SVG on a page, e.g. checkboxes. (This need is largely an artificial constraint where the page renders fine, but it reduces our a11y score due to the rule I linked to.) |
How to fix problem with xlink:href? cleanupId seems to be ignoring this |
@VityaSchel: With |
Hm, is this plugin similar to yours? |
Please let us know what would be the direction here? cleanupIDs: {
prefix: {
toString() {
this.counter = this.counter || 0
return this.counter++
},
},
}, |
How are you guys achieving that ☝️ with the new plug-in format? I can't get the counter to work since I can't override |
Hey, folks. I've had a similar problem where I needed to ensure a unique That's what worked for me: // Generate a unique ID per the entire SVG.
const id = Math.random().toString(32).slice(2)
const thumbnailSvg = svgo.optimize(rawThumbnailSvg, {
path: thumbnailSvgPath,
plugins: [
{
name: 'prefixIds',
params: {
// Use that ID here.
// Do NOT generate the ID itself in the "prefix" function
// because that will result in each ID being unique,
// breaking the gradient references within a single SVG.
prefix: id,
},
},
],
}) Hope this helps. |
@maxarias-io did you managed to do it in the new svgo.config format? Wonder why this issue is closed, if this problem stills persist. |
I didn't. As a stop-gap I'm using https://github.com/shubhamjain/svg-loader |
Ok. thanks for your anwser. My solution was just change the svgs files names... The IDs are generated with the name of the file, so if you have unique file names, they dont conflit! 👍 |
In order to be deterministic without requiring an explicit config or relying on the file name, would it make any sense to: generate w/ default ids -> get file content hash -> use file hash as prefix & update id names in final output? |
Hi there, the last answers didn't work for me. Example here: I wanted to add an id on my svg, to be able to use it when imported, so I did as follow ( /**
* @type {import("svgo").Config}
*/
module.exports = {
multipass: false,
js2svg: {
indent: 2,
pretty: true,
},
plugins: [
'preset-default',
{
name: 'createId',
fn: ({ children }, _, info) => {
const childAttributes = children[0].attributes
const [fileName] = info.path.split('/').reverse()[0].split('.')
childAttributes.id = fileName
},
},
],
} If it can help.. :) |
Since @SethFalco fixed some problems with A simpler alternative which does not rely on any imports is a simple counter, can also confirm this works in our project: let svgoPrefixIdsCount = 0;
/** @type {import('svgo').Config} */
const svgoConfig = {
plugins: [
'preset-default',
// Avoid collisions with ids in other SVGs,
// which was causing incorrect gradient directions
// https://github.com/svg/svgo/issues/1746#issuecomment-1803600573
//
// Previously, this was a problem where unique ids
// could not be generated since svgo@3
// https://github.com/svg/svgo/issues/674
// https://github.com/svg/svgo/issues/1746
{
name: 'prefixIds',
params: {
delim: '',
prefix: () => svgoPrefixIdsCount++,
},
},
],
};
export default svgoConfig; More discussion in #1746 |
… qwik nodes Enable the prefixIds SVGO plugin by default, while still allowing customization. This is a follow up on QwikDev#5407. Here's a discussion on why it makes sense when optimizing SVG files for the web: svg/svgo#674.
… qwik nodes (#5497) Enable the prefixIds SVGO plugin by default, while still allowing customization. This is a follow up on #5407. Here's a discussion on why it makes sense when optimizing SVG files for the web: svg/svgo#674.
* add created/updated date to docs frontmatter * read the frontmatter (#1) * feat: show updated docs showing the updated docs with a circle next to the title, in this commit I added the circles. * chore(docs): remove warnings (#5345) * style(eslint): convey a stricter restriction from `just` to `only` (examples) (#5340) * feat(vite): allow disabling dev SSR server in vite (#5347) * chore(docs): Small fix of file to edit (#5348) * docs: Update index.mdx (#5351) * Update index.mdx Correct mistake. The original was: Both pages are created by adding ... Changed to: Pages are created by adding ... * trigger GH checks --------- Co-authored-by: gioboa <[email protected]> * fix: action redirect accidentally stripped searchparams (#5349) Fix #5342 * fix: remove cf pages stream polyfill (#5352) * chore: updated twitter logo to X (#5357) * docs: update React cheat sheet title (#5358) * 1.2.15 (#5359) * docs: improve SEO with descriptions (#5360) * fix(cli): parseTemplatePath doesn't work in windows (#5339) * fix(cli) parseTemplatePath doesn't work in windows * refactor use path.sep --------- Co-authored-by: Yale <[email protected]> * docs: fix typo (#5361) * chore(qwik-insights): use clientOutDir if provided (#5366) * docs: remove soundy.cloud (#5374) * chore: clean up release script (#5376) * fix(qwik): Incorrect module reference in inlinedQrl (#5375) * fix(qwik): Incorrect module reference in inlinedQrl Fix #5368 * fixup! fix(qwik): Incorrect module reference in inlinedQrl * docs: Alex Russell Approved javascript framework (#5364) * docs: Alex Russell Approved Alex Russell Approved JavaScript framework * docs(faq): wording * chore: improved README.md for build artifacts (#5377) * fix(qwik-city): parseBody should not clone Request (#5353) fix(qwik-city): parseBody should not clone requests * docs(eslint-rules): refactor use-method-usage to reflect current qwik… (#5344) * docs(eslint-rules): refactor use-method-usage to reflect current qwik API * refactored unit tests * re-add TSAsExpression * word change: just -> only, to reflect latest PR --------- Co-authored-by: Miško Hevery <[email protected]> * fix: Yarn 3/4 PnP compatibility (#5042) * CI * revert --------- Co-authored-by: Roman Zanettin <[email protected]> * Revert "refactor(optimizer): remove using resolvePackageData API from Vite" (#5379) Revert "refactor(optimizer): remove using resolvePackageData API from Vite (#5312)" This reverts commit ec53ef7. * docs: update Alex Russell (#5381) * chore: 1.2.16 (#5382) * fix(labs): Better handling and visibility of q-insights.json (#5384) * feat(insights): Add new route visibility (#5385) * fix(vite): resolution of nested dependencies Co-authored-by: Manu MA <[email protected]> * docs: fix incorrect escaping in URL (#5387) * fix(insights): improve files per cluster (#5388) Increase clustering distance which should result in creation of fewer clusters. Fewer clusters means that less files should be downloaded to the client (each file will have more symbols.) This should improve performance. * fix(qwik): Improve logging of vite plugin (#5389) fix(qwik): Improve logging of vite plugin The log now includes file location and code snippet. * fix(core): parent component lookup during pause the parentCtx attribute was optimized to point directly to parents with $contexts$ defined, but that broke pausing which needs the immediate parent. Co-authored-by: Jesse Zhang <[email protected]> * chore: clean up docs site build warnings (#5391) * docs: explain custom event props and detail when PropFunction is needed (#5386) * docs: don't index demos; don't duplicate meta descriptions (#5392) * docs: add custom 404 page (#5393) * chore(docs): small improvements to routing/index.mdx * refactor(package.json): add docs.dev & docs.preview Add pnpm docs.dev & pnpm docs.preview commands to improve the DX for contributors. * chore: 1.2.17 (#5397) * fix(insight): use relative path (#5399) * docs: Update media page with new YouTube video links (#5401) Update media page with new YouTube video links * chore(starters): add VSCode debug setting (#5408) * docs(integrations): astro integration docs (#5409) * docs(integrations): astro integration docs * docs(integration): typo * docs(docs): updated docs changes * docs(menu): Add Astro integration to menu (#5410) * Add Astro integration to menu * Add description and keywords to Astro integration page, and update contributor list. * chore(docs): update node integration page (#5413) Bold statement regarding `ORIGIN` env var. * fix(qwik-city): vercel adapter default to `webworker` target (#5414) * docs: correct broken image (#5415) * docs(astro): Qwik + Astro doc improvements (#5416) * Qwik astro doc improvements * typo fix * fix(propfunctionprops): prevent 'undefined', 'null', 'never' conversion to PropFnInterface (#5363) * fix(propfunctionprops): prevent 'undefined', 'null', 'never' conversion to PropFnInterface fix #4946 * improve PropFunctionProps readability and edge-cases * fix never becoming undefined * fixup! fix never becoming undefined * refine tests --------- Co-authored-by: Miško Hevery <[email protected]> * fix(qwik-city): better type for svg?jsx imports (#5420) * fix(qwik-city): fix rendered svg?jsx component closing tag (#5423) * fix: fix optimized svg closing tag * test: add svg optimizer test * fix: cache max-age vite.config for dev mode (#5427) * fix(cli): casing for component and mdx route creation (#5430) * docs: fix broken image (#5432) * docs: fixed small typo (#5434) * docs: add missing contributors (#5435) * fix: 3rd party imports of libs during build (#5431) Co-authored-by: Miško Hevery <[email protected]> * fix(docs): improve SEO (#5439) * feat(core): auto px addition to css properties for unitless numbers (#5426) * feat(core): auto px addition to css properties for unitless numbers This adds support for auto-addition of 'px' to css properties * add tests to check styles in both ssr and csr * docs: Add link to create new Qwik Insights app as self-serve (#5443) * fix: Pass the missing props for Spinner component (#5437) Pass the missing props for Spinner component As the `growing` props is missing in the bootstrap starter template `Spinner` component it is causing the issue in production build while testing after adding the bootstrap. * fix(docs): Wrap function in cleanup function instead of returning it (#5440) Wrap function in cleanup function instead of returning it * fix(docs): typo in qwikcity -> Validator docs (#5444) --------- Co-authored-by: gioboa <[email protected]> * fix(docs): typo in qwik city -> middleware page (#5446) --------- Co-authored-by: gioboa <[email protected]> * fix(docs): update links for Edit this page button (#5445) --------- Co-authored-by: gioboa <[email protected]> * chore: 1.2.18 (#5449) * docs: Add Component library `ionic-qwik` to community projects on docs. (#5429) Add Component library `ionic-qwik`. * chore(docs): advanced usage of Slot, visibleTask (#5424) chore(docs): advanced Slot, visibleTask, Context * chore(core): update `QwikKeyboardEvent` type (#5433) chore(core): update keyboardevent to have code attr and update deprecated attrs * fix(docs): remove `inline-code` and `link` in tag `<a />` (#5450) --------- Co-authored-by: wangyipeng <[email protected]> Co-authored-by: Giorgio Boa <[email protected]> * docs(ssg): fix shell command (#5459) * docs(auth.js): add credentials example (#5462) * chore: 1.2.19 (#5466) * chore(all): Vite 5 upgrade * chore(core): remove resolvePackageData (#5312) * chore: pnpm api.update * feat(playground): remove broken versions * feat: add qwik/no-use-visible-task eslint rule (#5455) * feat: add qwik/no-use-visible-task eslint rule ---- Co-authored-by: Matteo Pietro Dazzi <[email protected]> Co-authored-by: Pasquale De Lucia <[email protected]> Co-authored-by: Gloria Giannascoli <[email protected]> Co-authored-by: pietrodev07 <[email protected]> * linter 🧽 * feat: add extra tips * fix: change message * docs: add missing eslint recap * chore(insights): remove unnecessary log (#5461) * fix: add example context to docs (#5467) * feat(qwik-city): allow customizing SVGO options of image plugin (#5407) * docs: fix typo * docs: fix typo (#5481) * fix(core): Support JSX in signals (#5442) Fix #4966 Fix #3530 * docs(FAQ): - lazy-loading on user interaction & speculative module fetching (#5488) docs: FAQ - lazy-loading on user interaction & speculative module fetching * docs(faq): add link to typescript (#5487) * fix: disable Vite modulepreload (#5493) * fix: disable Vite modulePreload Fixed: #5478 * chore: use cleaner option * docs(faq): fix typos and improve the wording of some sentences (#5490) * docs: make the distinction between module-prefetching and <Link prefetch> (#5485) docs(module-prefetching): make the distinction between module-prefetching and <Link prefetch> * docs(showcase): add `index.app` and `wiza.co` (#5484) Update pages.json * fix(docs): mdx interpreting title as component (#5499) * docs: cleanup the vdom section (#5500) * fix: revert "fix: remove cf pages stream polyfill" (#5502) * fix(qwik-city): prefix ids of SVGs based on their path when loaded as qwik nodes (#5497) Enable the prefixIds SVGO plugin by default, while still allowing customization. This is a follow up on #5407. Here's a discussion on why it makes sense when optimizing SVG files for the web: svg/svgo#674. * fix: cf pages polyfill only if needed (#5507) fix: polyfill only if needed * refactor: extract group type * docs: add QwikCityMockProvider explanation (#5505) * Extend index.mdx to include QwikCityMockProvider * docs: add links between vitest integration page and qwikcity api page * docs(glob-import): add documentation for import.meta.glob (#5504) * docs(glob-import): add documentation for import.meta.glob * docs(glob-imports): add Glob Import link to /cookbook/index.mdx * docs(glob-import): refactor type any to Record<string, any> * docs: add Record<string, any> to mdx as well * fix: CF pages polyfill also when shimmed (#5512) * fix: polyfill also when shimmed * chore: add comment to explain polyfill * chore: Giorgio's feedback * refactor: made the renderUpdate as a const put the mardown update in a const which made the code cleaner and better to understand * fix: fixed build * docs: api update * refactor: build * chore: fix pnpm-locke file * chore: build * chore: pnpm fmt * refactor: removed style-system --------- Co-authored-by: Marcos Perona <[email protected]> Co-authored-by: Giorgio Boa <[email protected]> Co-authored-by: Alex Tocar <[email protected]> Co-authored-by: Miško Hevery <[email protected]> Co-authored-by: Nelson Sousa <[email protected]> Co-authored-by: Runar Jordahl <[email protected]> Co-authored-by: gioboa <[email protected]> Co-authored-by: Kaushik080 <[email protected]> Co-authored-by: Yoav Ganbar <[email protected]> Co-authored-by: yale.yu <[email protected]> Co-authored-by: Yale <[email protected]> Co-authored-by: Bonny87 <[email protected]> Co-authored-by: D <[email protected]> Co-authored-by: PatrickJS <[email protected]> Co-authored-by: Maïeul <[email protected]> Co-authored-by: Ian Létourneau <[email protected]> Co-authored-by: Roman Zanettin <[email protected]> Co-authored-by: Wout Mertens <[email protected]> Co-authored-by: Manu MA <[email protected]> Co-authored-by: Jesse Zhang <[email protected]> Co-authored-by: maieulchevalier <[email protected]> Co-authored-by: Jack Shelton <[email protected]> Co-authored-by: Erik Eng <[email protected]> Co-authored-by: Steve Sewell <[email protected]> Co-authored-by: Riccardo Perra <[email protected]> Co-authored-by: Pasquale De Lucia <[email protected]> Co-authored-by: Sidharth Mohanty <[email protected]> Co-authored-by: Daniela Bonvini <[email protected]> Co-authored-by: Shai Reznik <[email protected]> Co-authored-by: Lucas Stahl <[email protected]> Co-authored-by: John Prem Kumar S <[email protected]> Co-authored-by: Thomas Deinhamer <[email protected]> Co-authored-by: Harish Krishnan <[email protected]> Co-authored-by: Juer Genie Whang <[email protected]> Co-authored-by: Juer Genie Whang <[email protected]> Co-authored-by: wangyipeng <[email protected]> Co-authored-by: Bjorn Lu <[email protected]> Co-authored-by: Arjun <[email protected]> Co-authored-by: Bendegúz Hajnal <[email protected]> Co-authored-by: ulic75 <[email protected]> Co-authored-by: Youssef Adbib <[email protected]> Co-authored-by: Necati <[email protected]> Co-authored-by: Leo <[email protected]> Co-authored-by: mulztob <[email protected]>
* add created/updated date to docs frontmatter * read the frontmatter (#1) * feat: show updated docs showing the updated docs with a circle next to the title, in this commit I added the circles. * chore(docs): remove warnings (#5345) * style(eslint): convey a stricter restriction from `just` to `only` (examples) (#5340) * feat(vite): allow disabling dev SSR server in vite (#5347) * chore(docs): Small fix of file to edit (#5348) * docs: Update index.mdx (#5351) * Update index.mdx Correct mistake. The original was: Both pages are created by adding ... Changed to: Pages are created by adding ... * trigger GH checks --------- Co-authored-by: gioboa <[email protected]> * fix: action redirect accidentally stripped searchparams (#5349) Fix #5342 * fix: remove cf pages stream polyfill (#5352) * chore: updated twitter logo to X (#5357) * docs: update React cheat sheet title (#5358) * 1.2.15 (#5359) * docs: improve SEO with descriptions (#5360) * fix(cli): parseTemplatePath doesn't work in windows (#5339) * fix(cli) parseTemplatePath doesn't work in windows * refactor use path.sep --------- Co-authored-by: Yale <[email protected]> * docs: fix typo (#5361) * chore(qwik-insights): use clientOutDir if provided (#5366) * docs: remove soundy.cloud (#5374) * chore: clean up release script (#5376) * fix(qwik): Incorrect module reference in inlinedQrl (#5375) * fix(qwik): Incorrect module reference in inlinedQrl Fix #5368 * fixup! fix(qwik): Incorrect module reference in inlinedQrl * docs: Alex Russell Approved javascript framework (#5364) * docs: Alex Russell Approved Alex Russell Approved JavaScript framework * docs(faq): wording * chore: improved README.md for build artifacts (#5377) * fix(qwik-city): parseBody should not clone Request (#5353) fix(qwik-city): parseBody should not clone requests * docs(eslint-rules): refactor use-method-usage to reflect current qwik… (#5344) * docs(eslint-rules): refactor use-method-usage to reflect current qwik API * refactored unit tests * re-add TSAsExpression * word change: just -> only, to reflect latest PR --------- Co-authored-by: Miško Hevery <[email protected]> * fix: Yarn 3/4 PnP compatibility (#5042) * CI * revert --------- Co-authored-by: Roman Zanettin <[email protected]> * Revert "refactor(optimizer): remove using resolvePackageData API from Vite" (#5379) Revert "refactor(optimizer): remove using resolvePackageData API from Vite (#5312)" This reverts commit ec53ef7834dd76af0fca1f90c903d93f6cb802f6. * docs: update Alex Russell (#5381) * chore: 1.2.16 (#5382) * fix(labs): Better handling and visibility of q-insights.json (#5384) * feat(insights): Add new route visibility (#5385) * fix(vite): resolution of nested dependencies Co-authored-by: Manu MA <[email protected]> * docs: fix incorrect escaping in URL (#5387) * fix(insights): improve files per cluster (#5388) Increase clustering distance which should result in creation of fewer clusters. Fewer clusters means that less files should be downloaded to the client (each file will have more symbols.) This should improve performance. * fix(qwik): Improve logging of vite plugin (#5389) fix(qwik): Improve logging of vite plugin The log now includes file location and code snippet. * fix(core): parent component lookup during pause the parentCtx attribute was optimized to point directly to parents with $contexts$ defined, but that broke pausing which needs the immediate parent. Co-authored-by: Jesse Zhang <[email protected]> * chore: clean up docs site build warnings (#5391) * docs: explain custom event props and detail when PropFunction is needed (#5386) * docs: don't index demos; don't duplicate meta descriptions (#5392) * docs: add custom 404 page (#5393) * chore(docs): small improvements to routing/index.mdx * refactor(package.json): add docs.dev & docs.preview Add pnpm docs.dev & pnpm docs.preview commands to improve the DX for contributors. * chore: 1.2.17 (#5397) * fix(insight): use relative path (#5399) * docs: Update media page with new YouTube video links (#5401) Update media page with new YouTube video links * chore(starters): add VSCode debug setting (#5408) * docs(integrations): astro integration docs (#5409) * docs(integrations): astro integration docs * docs(integration): typo * docs(docs): updated docs changes * docs(menu): Add Astro integration to menu (#5410) * Add Astro integration to menu * Add description and keywords to Astro integration page, and update contributor list. * chore(docs): update node integration page (#5413) Bold statement regarding `ORIGIN` env var. * fix(qwik-city): vercel adapter default to `webworker` target (#5414) * docs: correct broken image (#5415) * docs(astro): Qwik + Astro doc improvements (#5416) * Qwik astro doc improvements * typo fix * fix(propfunctionprops): prevent 'undefined', 'null', 'never' conversion to PropFnInterface (#5363) * fix(propfunctionprops): prevent 'undefined', 'null', 'never' conversion to PropFnInterface fix #4946 * improve PropFunctionProps readability and edge-cases * fix never becoming undefined * fixup! fix never becoming undefined * refine tests --------- Co-authored-by: Miško Hevery <[email protected]> * fix(qwik-city): better type for svg?jsx imports (#5420) * fix(qwik-city): fix rendered svg?jsx component closing tag (#5423) * fix: fix optimized svg closing tag * test: add svg optimizer test * fix: cache max-age vite.config for dev mode (#5427) * fix(cli): casing for component and mdx route creation (#5430) * docs: fix broken image (#5432) * docs: fixed small typo (#5434) * docs: add missing contributors (#5435) * fix: 3rd party imports of libs during build (#5431) Co-authored-by: Miško Hevery <[email protected]> * fix(docs): improve SEO (#5439) * feat(core): auto px addition to css properties for unitless numbers (#5426) * feat(core): auto px addition to css properties for unitless numbers This adds support for auto-addition of 'px' to css properties * add tests to check styles in both ssr and csr * docs: Add link to create new Qwik Insights app as self-serve (#5443) * fix: Pass the missing props for Spinner component (#5437) Pass the missing props for Spinner component As the `growing` props is missing in the bootstrap starter template `Spinner` component it is causing the issue in production build while testing after adding the bootstrap. * fix(docs): Wrap function in cleanup function instead of returning it (#5440) Wrap function in cleanup function instead of returning it * fix(docs): typo in qwikcity -> Validator docs (#5444) --------- Co-authored-by: gioboa <[email protected]> * fix(docs): typo in qwik city -> middleware page (#5446) --------- Co-authored-by: gioboa <[email protected]> * fix(docs): update links for Edit this page button (#5445) --------- Co-authored-by: gioboa <[email protected]> * chore: 1.2.18 (#5449) * docs: Add Component library `ionic-qwik` to community projects on docs. (#5429) Add Component library `ionic-qwik`. * chore(docs): advanced usage of Slot, visibleTask (#5424) chore(docs): advanced Slot, visibleTask, Context * chore(core): update `QwikKeyboardEvent` type (#5433) chore(core): update keyboardevent to have code attr and update deprecated attrs * fix(docs): remove `inline-code` and `link` in tag `<a />` (#5450) --------- Co-authored-by: wangyipeng <[email protected]> Co-authored-by: Giorgio Boa <[email protected]> * docs(ssg): fix shell command (#5459) * docs(auth.js): add credentials example (#5462) * chore: 1.2.19 (#5466) * chore(all): Vite 5 upgrade * chore(core): remove resolvePackageData (#5312) * chore: pnpm api.update * feat(playground): remove broken versions * feat: add qwik/no-use-visible-task eslint rule (#5455) * feat: add qwik/no-use-visible-task eslint rule ---- Co-authored-by: Matteo Pietro Dazzi <[email protected]> Co-authored-by: Pasquale De Lucia <[email protected]> Co-authored-by: Gloria Giannascoli <[email protected]> Co-authored-by: pietrodev07 <[email protected]> * linter 🧽 * feat: add extra tips * fix: change message * docs: add missing eslint recap * chore(insights): remove unnecessary log (#5461) * fix: add example context to docs (#5467) * feat(qwik-city): allow customizing SVGO options of image plugin (#5407) * docs: fix typo * docs: fix typo (#5481) * fix(core): Support JSX in signals (#5442) Fix #4966 Fix #3530 * docs(FAQ): - lazy-loading on user interaction & speculative module fetching (#5488) docs: FAQ - lazy-loading on user interaction & speculative module fetching * docs(faq): add link to typescript (#5487) * fix: disable Vite modulepreload (#5493) * fix: disable Vite modulePreload Fixed: #5478 * chore: use cleaner option * docs(faq): fix typos and improve the wording of some sentences (#5490) * docs: make the distinction between module-prefetching and <Link prefetch> (#5485) docs(module-prefetching): make the distinction between module-prefetching and <Link prefetch> * docs(showcase): add `index.app` and `wiza.co` (#5484) Update pages.json * fix(docs): mdx interpreting title as component (#5499) * docs: cleanup the vdom section (#5500) * fix: revert "fix: remove cf pages stream polyfill" (#5502) * fix(qwik-city): prefix ids of SVGs based on their path when loaded as qwik nodes (#5497) Enable the prefixIds SVGO plugin by default, while still allowing customization. This is a follow up on QwikDev/qwik#5407. Here's a discussion on why it makes sense when optimizing SVG files for the web: svg/svgo#674. * fix: cf pages polyfill only if needed (#5507) fix: polyfill only if needed * refactor: extract group type * docs: add QwikCityMockProvider explanation (#5505) * Extend index.mdx to include QwikCityMockProvider * docs: add links between vitest integration page and qwikcity api page * docs(glob-import): add documentation for import.meta.glob (#5504) * docs(glob-import): add documentation for import.meta.glob * docs(glob-imports): add Glob Import link to /cookbook/index.mdx * docs(glob-import): refactor type any to Record<string, any> * docs: add Record<string, any> to mdx as well * fix: CF pages polyfill also when shimmed (#5512) * fix: polyfill also when shimmed * chore: add comment to explain polyfill * chore: Giorgio's feedback * refactor: made the renderUpdate as a const put the mardown update in a const which made the code cleaner and better to understand * fix: fixed build * docs: api update * refactor: build * chore: fix pnpm-locke file * chore: build * chore: pnpm fmt * refactor: removed style-system --------- Co-authored-by: Marcos Perona <[email protected]> Co-authored-by: Giorgio Boa <[email protected]> Co-authored-by: Alex Tocar <[email protected]> Co-authored-by: Miško Hevery <[email protected]> Co-authored-by: Nelson Sousa <[email protected]> Co-authored-by: Runar Jordahl <[email protected]> Co-authored-by: gioboa <[email protected]> Co-authored-by: Kaushik080 <[email protected]> Co-authored-by: Yoav Ganbar <[email protected]> Co-authored-by: yale.yu <[email protected]> Co-authored-by: Yale <[email protected]> Co-authored-by: Bonny87 <[email protected]> Co-authored-by: D <[email protected]> Co-authored-by: PatrickJS <[email protected]> Co-authored-by: Maïeul <[email protected]> Co-authored-by: Ian Létourneau <[email protected]> Co-authored-by: Roman Zanettin <[email protected]> Co-authored-by: Wout Mertens <[email protected]> Co-authored-by: Manu MA <[email protected]> Co-authored-by: Jesse Zhang <[email protected]> Co-authored-by: maieulchevalier <[email protected]> Co-authored-by: Jack Shelton <[email protected]> Co-authored-by: Erik Eng <[email protected]> Co-authored-by: Steve Sewell <[email protected]> Co-authored-by: Riccardo Perra <[email protected]> Co-authored-by: Pasquale De Lucia <[email protected]> Co-authored-by: Sidharth Mohanty <[email protected]> Co-authored-by: Daniela Bonvini <[email protected]> Co-authored-by: Shai Reznik <[email protected]> Co-authored-by: Lucas Stahl <[email protected]> Co-authored-by: John Prem Kumar S <[email protected]> Co-authored-by: Thomas Deinhamer <[email protected]> Co-authored-by: Harish Krishnan <[email protected]> Co-authored-by: Juer Genie Whang <[email protected]> Co-authored-by: Juer Genie Whang <[email protected]> Co-authored-by: wangyipeng <[email protected]> Co-authored-by: Bjorn Lu <[email protected]> Co-authored-by: Arjun <[email protected]> Co-authored-by: Bendegúz Hajnal <[email protected]> Co-authored-by: ulic75 <[email protected]> Co-authored-by: Youssef Adbib <[email protected]> Co-authored-by: Necati <[email protected]> Co-authored-by: Leo <[email protected]> Co-authored-by: mulztob <[email protected]>
This is a feature request.
There's a plugin for minifying IDs but this is basically useless when inlining SVGs in HTML because it is guaranteed to cause problems (i.e. when inlining at least two SVGs that contain IDs you're guaranteed to have a conflict on ID "a").
It would be very useful if SVGO allowed prefixing IDs with a configurable key. This would allow tooling like
react-svg-loader
to generate a unique prefix and pass it to SVGO to guarantee the IDs don't break when the SVGs are inlined.A problem is that the IDs can be referenced with
xlink:href
attributes andurl()
values but this is already addressed by thecleanupIDs
plugin.The text was updated successfully, but these errors were encountered: