-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
59 lines (48 loc) · 1.55 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
/// <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) {
return src(path, { base: baseFolder })
.pipe(dest(target));
}
function watchAppPlugins() {
watch(appPlugin.source, { ignoreInitial: false })
.on('change', function (path, stats) {
copy(path, appPlugin.src, config.site + appPluginPath)
copy(path, appPlugin.src, config.site + "V9" + appPluginPath)
copy(path, appPlugin.src, config.site + "V10" + appPluginPath)
})
.on('add', function (path, stats) {
copy(path, appPlugin.src, config.site + appPluginPath)
copy(path, appPlugin.src, config.site + "V9" + appPluginPath)
copy(path, appPlugin.src, config.site + "V10" + appPluginPath)
});
}
exports.default = function () {
watchAppPlugins();
};