While linking or editing a web resource, you can specify a Gulp task to run prior to the web resource being published to CRM. This allows you to minify, merge your file with other files, or perform any other Gulp operation to the file prior to being published to CRM. The following file types are supported:
XrmToolkit also passes the following two parameters to the Gulp command line that you can use within your Gulp task.
Using these parameters allows you to create re-usable tasks that can be used for any file. An example is shown below demonstrating a Gulp task that simply moves both the source and jsoutputfile to two different locations. Most likely your tasks will contain more logic to minify or combine multiple files into a single file.
var gulp = require('gulp'); var argv = require('yargs').argv; gulp.task('copyScripts:tsCopyIndividualPage', function () { var sourceFile = argv.sourcefile; var jsoutputfile = argv.jsoutputfile; var buildConfig = argv.buildConfiguration; gulp.src(sourceFile) .pipe(gulp.dest('./Web/scripts/forms/src/')); if(buildConfig == 'Debug') { gulp.src(jsoutputfile) .pipe(gulp.dest('./Web/scripts/forms/debug/')); } else { gulp.src(jsoutputfile) .pipe(gulp.dest('./Web/scripts/forms/release/')); } });