Skip to content

Build options

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

Build options are a layer of settings which can be defined for a project to set up its unique build workflow.

Settings are stored in ./config/app.json file.

Schema

It's possible to reference schema definition in the setting:

{
  "$schema": "../node_modules/sp-build-tasks/schema/v1/sppp.json"
}

Available properties should be shown with intellisense in a very user-friendly way:

Schema

Example setup:

{
  "spFolder": "_catalogs/masterpage/spf",
  "distFolder": "./dist",

  "customStyles": [{
    "src": "styles/frankfurt/frankfurt.scss",
    "dist": "styles/frankfurt.min.css"
  }],

  "bundleJSLibsFiles": [
    "./node_modules/es6-promise/dist/es6-promise.auto.min.js",
    "./node_modules/whatwg-fetch/fetch.js",
    "./node_modules/sp-pnp-js/dist/pnp.js"
  ],

  "bundleCSSLibsFiles": [
    "./node_modules/datatables/media/css/jquery.dataTables.min.css"
  ],

  "copyAssetsMap": [{
    "src": [
      "./node_modules/datatables/media/images",
      "./src/images",
      "./src/scripts/modules/wysiwyg.js"
    ],
    "dist": "./dist"
  }],

  "webpackItemsMap": [{
    "entry": "./src/scripts/module-a.ts",
    "target": "module-a.js",
    "webpackConfig": {
      "cache": true,
      "devtool": "source-map",
      "plugins": []
    }
  }],
  "webpackConfig": {
    "cache": true,
    "devtool": "source-map",
    "plugins": []
  },

  "masterpagePath": "masterpage/frankfurt.master",
  "logoPath": "images/logo.png",
  "masterpageCodeName": "frankfurt",
  "platformVersion": "2016",
  "masterpage": {
    "copyright": {
      "year": "2017",
      "title": "Contoso intranet"
    }
  }

}