MrPowerGamerBR
11/23/2021, 3:20 PM@JsModule("./star.svg")
@JsNonModule
external val star: dynamic
console.log(star)
= <http://localhost:8080/images/8879ae8fb00946dae2fd.svg>
, instead of printing the svg content. I want the svg to be inlined (because animations) so that's why I can't just reference the svg in a <img> tagMrPowerGamerBR
11/23/2021, 3:39 PMProject Root Folder/webpack.config.d
config.module.rules.push(
{
test: /\.(svg)$/i,
type: 'asset/source'
}
);
@JsModule("./star.svg")
@JsNonModule
external val star: dynamic
console.log(star)
Prints...
<svg xmlns="<http://www.w3.org/2000/svg>" viewBox="0 0 576 512"><!-- Font Awesome Free 5.15.1 by @fontawesome - <https://fontawesome.com> License - <https://fontawesome.com/license/free> (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path fill="#ffffff" d="M528.1 171.5L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6zM388.6 312.3l23.7 138.4L288 385.4l-124.3 65.3 23.7-138.4-100.6-98 139-20.2 62.2-126 62.2 126 139 20.2-100.6 98z"/></svg>
If you are curious about other available "type", check out https://webpack.js.org/guides/asset-modules/turansky
11/23/2021, 3:56 PMturansky
11/23/2021, 3:57 PMturansky
11/23/2021, 4:00 PMfun main() {
val icon = require("icons/star.svg")
}
MrPowerGamerBR
11/23/2021, 9:19 PMturansky
11/23/2021, 11:33 PMsvg-inline-loader
Florent Martin
06/28/2022, 5:16 AMturansky
06/28/2022, 10:59 AMsvg-inline-loader
will be configured by default, if you will apply kfc.application
pluginFlorent Martin
07/15/2022, 9:30 AMid("io.github.turansky.kfc.application") version "5.45.0"
:
Cannot add extension with name 'kotlin', as there is an extension already registered with that name.
Do you have an idea where this could come from?
Setup is Multiplatform & Springbootturansky
07/15/2022, 10:02 AM