Closed
Description
Command
build
Description
Please add the ability to import .svg in .ts with esbuild.
Example of use case:
import icons from "../assets/icons/icons.svg";
export class IconModule {
constructor(iconRegistry: MatIconRegistry, sanitizer: DomSanitizer) {
iconRegistry.addSvgIconSetLiteral(sanitizer.bypassSecurityTrustHtml(icons))
}
}
In this specific use case we could use addSvgIconSetLiteral
and an URL but the svg won't be part of the build anymore.
When it's part of the build we can have size stats about svg in our bundle and possibly get the .svg files hashed (cache busting), useful when you set multiple svg files inside a single svg using symbols (which angular component icon supports btw).
We could also import it directly in a template without having to create a svg component
Describe the solution you'd like
No response
Describe alternatives you've considered
As an alternative you can rename the .svg to .txt, it will be loaded using the esbuild text loader.
Metadata
Metadata
Assignees
Labels
No labels