Forum Discussion
john john
Nov 25, 2021Steel Contributor
Can get the current site collection url inside the "SharePoint/assets/elements.xml", inside SPFx
I am working on an SPFx web part, which inject a custom css inside the site collection. Now i define the location of the custom css file inside the ClientSideComponentProperties inside the SharePoint/assets/elements.xml file as follow:-
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction Title="InjectCss" Location="ClientSideExtension.ApplicationCustomizer" ClientSideComponentId="5a1fcffd-dfeb-4844-b478-1feb4325a5a7" ClientSideComponentProperties="{"cssurl":"/sites/Intranet-DEV/customcss/custom.css"}"> </CustomAction> </Elements>
so in the above case the custom.css file will be located inside a site collection with this static url https://ourtenat.sharepoint.com/sites/Intranet-DEV/customcss/custom.css.. but can i change the location of the file to be dynamically inside the current site collection (where the web part will be added) ? so on each site collection i will define a library named customcss and add the custom.css file inside it? is this possible?
Thanks
No RepliesBe the first to reply