What's best practice to add stylesheet / js / images / files in the design manager?

What I have done:

  • exported pretty mutch a standard design manager package from sharepoint (wsp)
  • imported it into Visual studio 2012

One way I was thinking of was to add a mapped layouts folder and put all the files there in different folders (js / stylesheet ..) ? How can I refer to those files? Do I need to add those into a element.xml file as well to get the files deployed?

enter image description here

1 Answer 1

  • Add New Item and add Sharepoint/Office Module type in project

  • Add the Folders and Files to the Module

  • In the elements file use this format:-

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="Scripts" Url="Style Library/Scripts">
    <File Path="DataTableAssets\Scripts\jquery.js" Url="jquery.js" Type="GhostableInLibrary" />
    <Module Name="Styles" Url="Style Library/Styles">
    <File Path="DataTableAssets\Styles\datatable.css" Url="datatable.css" Type="GhostableInLibrary" />
  • how do I refer to files inside a module? I need to refer to those files from ex masterpage, pagelayouts... etc
    – Plexus81
    Commented Sep 4, 2013 at 7:38
  • 1
    Like so:- <SharePoint:ScriptLink ID="ScriptLink1" Name="~SiteCollection/Style Library/Scripts/jquery.js" runat="server" /> Commented Sep 13, 2013 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.