Skip to content
Andrew Koltyakov edited this page Aug 9, 2018 · 3 revisions

Getting tasks list:

gulp --tasks
β”œβ”€β”€ config
β”œβ”€β”€ pull
β”œβ”€β”€ push
β”œβ”€β”€ live-reload
β”œβ”€β”€ masterpage
β”œβ”€β”€ custom-actions
β”œβ”€β”€ build
β”œβ”€β”€ watch
β”œβ”€β”€ live
β”œβ”€β”€ clean
β”œβ”€β”€ analyze
└── features:disable-mds

Config

gulp config

Inits SharePoint credentials prompt wizard.

Wizard is implemented using node-sp-auth-config library.

After config is done, auth settings are dumped to './config/private.json'.

The second run of the task checks './config/private.json' and do not prompt if it exists and all parameters for a specific are auth strategy are provided.

To force prompts dialog use:

gulp config --init

Pull

gulp pull

Initiates download of all remote assets from spFolder to ./dist folder.

This task can be useful if one is intended to check if the assets in SharePoint had been changed since last publish or in migration scenarios when some assets are already created in SharePoint (with SharePoint Designer, for instance).

Build front-end

gulp build

Build task combines multiple build actions, such as:

Production build

gulp build --prod

Used with Webpack build.

Build subtasks

A specific subtasks can be provided as gulp build parameters:

Parameter Description
--webpack webpack'ing .ts to single app.js buldle
--css-custom bundling custom css (from .scss)
--copy-assets copying static content
--js-libs bundling JavaScript libraries
--css-libs bundling CSS libraries or custom .css
--masterpage .hbs to .masterpage
--layouts .hbs to .aspx layouts
--webparts compiles .hbs CEWPs
gulp build --prod --webpack --webparts

Starts webparts and webpack tasks, also uses production build configs.

Publish (push)

gulp push

Uploads and publishes ./dist folder's content to remote spFolder in SharePoint. The task uses gulp-spsave for delivering assets to SharePoint.

Watching assets

Standard watch

gulp watch

Watches local files for changes and initiates build and publishing of changed sources.

The task watches for the following sources:

  • src
    • masterpage
      • [watches masterpage .hbs]
      • layouts
        • [watches layouts.hbs files]
    • scripts
      • [watches for .ts files changes]
    • styles
      • [watches for .scss files changes]
    • webpartc
      • [watches for .hbs files changes]

Watch in productions mode

gulp watch --prod

Watch with page live-reload

gulp live

Does the same as gulp watch, but also emits changed files paths within the live-reload local server.

Implements socket proactive reload using sp-live-reload library.

Deployment helpers

Apply custom masterpage

gulp masterpage

Applies custom masterpage to the SPWeb.

Restore Seattle masterpage

gulp masterpage --uninstall

Live-reload install

gulp reload

Installs live-reload client script globally on SPWeb as a User ScriptLink custom action.

Live-reload uninstall

gulp reload --uninstall

Remove live-reload client script custom action from SPWeb.

Custom actions

gulp custom-actions

Provisions custom actions from app.json settings.

gulp custom-actions --uninstall

Removes custom actions based on project namespace prefix.

Clean

gulp clean

Deletes ./dist and temporary fonders.

Analyze

gulp analyze

Initiates bundles analyzer.