-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (48 loc) · 1.41 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/// <binding ProjectOpened='default' />
//
const { watch, src, dest } = require('gulp');
var config = require('./paths.json');
/*
* app_plugin and build script.
*/
const appPluginPath = '/App_Plugins/' + config.pluginFolder;
const appPlugin = {
source : config.library + appPluginPath + '/**/*',
src : config.library + appPluginPath + '/',
dest : config.site + appPluginPath
}
/*
* Copys files from app_plugins folder in a library
* project into a test site.
*
* Your paths.config should look like:
*
* {
* "library": "myPackage.LibraryName",
* "pluginFolder": "MyPackageFolder",
* "site" : "../Sandbox.Site"
* }
*
* This will run in the background, so you don't need
* to rebuild your project when working on script files.
*/
function copy(path, baseFolder, target) {
console.log('copy: \x1b[36m%s\x1b[0m %s', path, target);
return src(path, { base: baseFolder })
.pipe(dest(target));
}
function watchAppPlugins() {
console.log()
console.log('Watching : ' + appPlugin.source);
console.log('Target : ' + appPlugin.dest);
watch(appPlugin.source, { ignoreInitial: false })
.on('change', function (path, stats) {
copy(path, appPlugin.src, appPlugin.dest)
})
.on('add', function (path, stats) {
copy(path, appPlugin.src, appPlugin.dest)
});
}
exports.default = function () {
watchAppPlugins();
};