Thanks for sharing this cool project.
I am getting missing parameter and not sure why? Looked through a lot of examples and still not sure which one I am missing? I am using SharePoint on Premise 2013
Config:
//Load gulp
var gulp = require('gulp');
//Load gulp plugins
var concat = require('gulp-concat'); //bundle
var uglify = require('gulp-uglify'); //minify
var rename = require('gulp-rename'); //renaming to min
var spsave = require('gulp-spsave'); //upload to SharePoin
var fs = require('fs');
var config = JSON.parse(fs.readFileSync('SharePoint.Assets.GulpDemo/settings.json'));
var $ = require('gulp-load-plugins')({lazy: true});
//Bundle JS files together into a single file
gulp.task('concat-js', function () {
gulp.src("./Scripts/*/.js")
.pipe(concat("GulpDemo.js"))
.pipe(gulp.dest("./Output"))
});
//Minify the GulpDemo.js file. This task has a dependency on concat-js which means concat-js will always run before minify-js
gulp.task('minify-js', ['concat-js'], function () {
gulp.src("./Output/GulpDemo.js")
.pipe(uglify())
.pipe(rename({ suffix: '.min'}))
.pipe(gulp.dest("./Output"))
});
//Upload GulpDemo.js and GulpDemo.min. jsfile. This task has a dependency on minify-js which means minify-js will always run before upload-to-sp
gulp.task('upload-to-sp', function () {
gulp.src("./Output/*.js")
.pipe($.debug())
.pipe($.spsave({
username: config.username,
password: config.password,
domain: config.domain,
siteUrl: 'https://anysites.com',
folder: "SiteAssets",
flatten: false,
notification: true
}));
});
//Watcher task. This will watch for any changes in the scenario1.js and scenario2.js files and then run the upload-to-sp task.
gulp.task('watch-js-upload-to-sp', function () {
gulp.watch("./Scripts/*/.js", ['upload-to-sp']);
});
gulp.task('default', ['concat-js','minify-js','upload-to-sp']);
Here is the message that I am getting:
6c4008b152f4:SharePoint.Assets.GulpDemo z001h4c$ history -cw
6c4008b152f4:SharePoint.Assets.GulpDemo z001h4c$ gulp upload-to-sp
[10:59:17] Using gulpfile ~SharePoint.Assets.GulpDemo/gulpfile.js
[10:59:17] Starting 'upload-to-sp'...
[10:59:17] 'upload-to-sp' errored after 23 ms
[10:59:17] Error in plugin 'gulp-spsave'
Message:
Missing parameters
[10:59:17] gulp-debug: Output/GulpDemo.js
[10:59:17] gulp-debug: Output/GulpDemo.min.js
[10:59:17] gulp-debug: 2 items
6c4008b152f4:SharePoint.Assets.GulpDemo$