Add-PnPJavaScriptLink render script link

Brass Contributor

Hi,
I'm trying to use Add-PnPJavaScriptLink to include some external js library, e.g as follows:

 

Add-PnPJavaScriptLink -Name jQuery -Url "https://code.jquery.com/jquery.min.js" -Sequence 10 -Scope Site

Currently it's rendering in follow format:

if (scriptsSrc.indexOf('https://code.jquery.com/jquery.min.js') === -1) {
	var newScript = document.createElement('script');
	newScript.id = 'jQuery';
	newScript.type = 'text/javascript';
	newScript.src='https://code.jquery.com/jquery.min.js';
	headID.appendChild(newScript);
	scriptsSrc.push('https://code.jquery.com/jquery.min.js');
}


Is it possible to use "ScriptLink" as the location to render the actual js link into the page? as in some cases the traditional way for referencing js library is still required.

 

Expected behavior:

<script type="text/javascript" src="https://code.jquery.com/jquery.min.js"></script>
1 Reply

the fix has been applied in SharePointPnPPowerShellOnline, thanks a lot for the effort.

can we please have the same feature updates for on premise? 
  

  • SharePointPnPPowerShell2013
  • SharePointPnPPowerShell2016


thx,

Shawn