Skip to content

Build options: Assets copy

Andrew Koltyakov edited this page Oct 6, 2017 · 2 revisions

It's better storing static assets in ./src or other folders, which are the part of the source control system.

Dist folder should be mapped with SharePoint asset folder. Also, the dist folder sometime should not be a part of sources and isn't stored in Git, for example. Aka, temporary folder.

Sometimes 3rd parties, like fonts, should be installed with npm or bower and deployed to SharePoint only partly, e.g. only a specific files out of numerous files of the 3rd party package.

Build tools can be configured to copy some static assets in ./config/app.json within the following parameters:

{
  ...
  // copyAssetsMap: Is an array of src/dist pairs objects
  "copyAssetsMap": [{
    // src: Is an array of paths to folders or files
    // Folders and files are copied based on this array, 
    // subfolders are created automatically
    "src": [
      "./node_modules/datatables/media/images",
      "./src/images",
      "./src/scripts/modules/wysiwyg.js"
    ],
    "dist": "./dist" // Target destination location where files are copied
  }],
  ...
}
Clone this wiki locally