locked
Custom Web Part Not Referencing JS/CSS Files Correctly RRS feed

  • Question

  • I have a client-side app that I've uploaded to the Style Library named "SPAngularTemplate".

    I created a custom webpart based off the Content Editor Webpart.  When I add this webpart to the page, it finds the "Style Library/SPAngularTemplate/index.html" file fine, but it's looking for the js includes in the "pages" library instead of "Style Library\SPAngularTemplate" directory.  I'm assuming this can be overridden in the .dwp file, but I cannot find any documentation on it:

    Network Error:

    It should be looking in Style Library/SPAngularTemplate instead of Pages.

    Here's my dwp file:

    <?xml version="1.0" encoding="utf-8"?>
    <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
    	<Assembly>Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
    	<Dir>default</Dir>
    	<TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
    	<Title>JamesTest</Title>
    	<ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">http://packers-www.ghcscw.com/Style Library/SPAngularTemplate/index.html</ContentLink>
    	<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"/>
    	<PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"/>
    </WebPart>

    Does anyone know how to fix this?

    Thanks

    Wednesday, January 10, 2018 4:24 PM

Answers

  • I figured it out.  When building the app I needed to update the references in the dist\index.html file to point from:

    inline.b7217c83dab93b04081e.bundle.js to

    /Style%20Library/SPAngularTemplate/inline.b7217c83dab93b04081e.bundle.j


    • Marked as answer by Jamezn2013 Wednesday, January 10, 2018 7:35 PM
    Wednesday, January 10, 2018 7:35 PM

All replies

  • I figured it out.  When building the app I needed to update the references in the dist\index.html file to point from:

    inline.b7217c83dab93b04081e.bundle.js to

    /Style%20Library/SPAngularTemplate/inline.b7217c83dab93b04081e.bundle.j


    • Marked as answer by Jamezn2013 Wednesday, January 10, 2018 7:35 PM
    Wednesday, January 10, 2018 7:35 PM
  • Hi,

    Thanks for sharing the solution with us, it will help others who stuck with the same issue in the forum.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, January 11, 2018 2:28 AM