Webpack dynamically create a module

后端 未结 2 1614
长发绾君心
长发绾君心 2021-02-04 06:53

I am writing a plugin which creates a SVG sprite. It globs over the directories, merge SVG files in one image and returns the result. The idea is to dynamically create a module

2条回答
  •  时光取名叫无心
    2021-02-04 07:33

    I have a somewhat not-so-elegant solution.Combine all svgs(by iterating over folder)into one html and hide that html snippet with a display:none.Have the ids as the fileName and ucan then access them by getElementById().innerHTML. Sample of jsp based snippet..or write in whichever language you want..

    <%@include file="svg/Download.svg" %>/span>Download <%@include file="svg/DownloadFAQs.svg" %> DownloadFAQs <%@include file="svg/DownloadQuickReferenceGuide.svg" %> DownloadQuickReferenceGuide <%@include file="svg/DownloadUserManual.svg" %> DownloadUserManual

提交回复
热议问题