mod-build 4.0.0-beta.4d → 4.0.0-beta.4e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/tasks/grab-shared-scripts.js +35 -20
package/package.json
CHANGED
|
@@ -25,15 +25,19 @@ let componentFolderPath = '';
|
|
|
25
25
|
|
|
26
26
|
function replaceModalyticsSrc(gulp, defaultSettings) {
|
|
27
27
|
const resourcePath = '/resources/scripts/mod-alytics/';
|
|
28
|
-
return
|
|
29
|
-
.
|
|
30
|
-
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
gulp.src(`${defaultSettings.srcFolder}/${componentFolderPath}/head/head.html`)
|
|
30
|
+
.pipe(replace(/".*(modalytics).*"/, `"${resourcePath}${fileNames.modAlyticsFileName}"`))
|
|
31
|
+
.pipe(gulp.dest(`${defaultSettings.srcFolder}/${componentFolderPath}/head`))
|
|
32
|
+
.on('finish', resolve);
|
|
33
|
+
});
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
function replaceFootAssetScripts(gulp, defaultSettings) {
|
|
34
37
|
const resourcePath = '/resources/scripts';
|
|
35
|
-
return
|
|
36
|
-
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
gulp.src(`${defaultSettings.srcFolder}/${componentFolderPath}/foot-assets/foot-assets.html`)
|
|
40
|
+
.pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"|"(?:(?!"|")[\s\S])+(callrail.*?)js"|"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"|"(?:(?!"|")[\s\S])+(mod-form\/form.*?)js"/g, function(match) {
|
|
37
41
|
if (match.includes('mod-form/form')) {
|
|
38
42
|
return `"${resourcePath}/mod-form/form/${fileNames.homeownerFormFileName}"`;
|
|
39
43
|
} else if (match.includes('callrail')) {
|
|
@@ -45,31 +49,42 @@ function replaceFootAssetScripts(gulp, defaultSettings) {
|
|
|
45
49
|
}
|
|
46
50
|
}))
|
|
47
51
|
.pipe(gulp.dest(`${defaultSettings.srcFolder}/${componentFolderPath}/foot-assets`))
|
|
48
|
-
.on('
|
|
52
|
+
.on('finish', function() {
|
|
53
|
+
resolve();
|
|
49
54
|
console.log('>> FINISHED replacing foot asset scripts');
|
|
50
55
|
});
|
|
56
|
+
});
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
function replaceAbandonmentJsCssSrc(gulp, defaultSettings) {
|
|
54
60
|
const jsResourcePath = '/resources/scripts/abandonment/';
|
|
55
61
|
const cssResourcePath = '/resources/styles/components/abandonment/';
|
|
56
|
-
return
|
|
57
|
-
.
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
return new Promise((resolve, reject) => {
|
|
63
|
+
gulp.src(defaultSettings.srcFolder + '/templates/abandonment/*.html')
|
|
64
|
+
.pipe(replace(/"(?:(?!"|")[\s\S])+(abandonment\/abandonment.*?)js"/, `"${jsResourcePath}${fileNames.abandonmentJsFileName}"`))
|
|
65
|
+
.pipe(replace(/"(?:(?!"|")[\s\S])+(components\/abandonment\/abandonment.*?)css"/, `"${cssResourcePath}${fileNames.abandonmentStylesFileName}"`))
|
|
66
|
+
.pipe(gulp.dest(defaultSettings.srcFolder + '/templates/abandonment'))
|
|
67
|
+
.on('finish', resolve);
|
|
68
|
+
});
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
function replaceFooterStylesReference(gulp, defaultSettings) {
|
|
63
72
|
if (pathSubdirectory) {
|
|
64
|
-
return
|
|
65
|
-
.
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
return new Promise((resolve, reject) => {
|
|
74
|
+
gulp.src(defaultSettings.publicFolder + '/resources/scripts/footer/' + fileNames.footerComponentJsFileName)
|
|
75
|
+
.pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/mod.*?)\)/, `concat("${pathSubdirectory}resources/styles/components/footer/` + fileNames.modFooterStylesFileName + '")'))
|
|
76
|
+
.pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/qs.*?)\)/, `concat("${pathSubdirectory}resources/styles/components/footer/` + fileNames.qsFooterStylesFileName + '")'))
|
|
77
|
+
.pipe(gulp.dest(defaultSettings.publicFolder + '/resources/scripts/footer'))
|
|
78
|
+
.on('finish', resolve);
|
|
79
|
+
});
|
|
68
80
|
} else {
|
|
69
|
-
return
|
|
70
|
-
.
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
return new Promise((resolve, reject) => {
|
|
82
|
+
gulp.src(defaultSettings.publicFolder + '/resources/scripts/footer/' + fileNames.footerComponentJsFileName)
|
|
83
|
+
.pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/mod.*?)\)/, 'concat("/resources/styles/components/footer/' + fileNames.modFooterStylesFileName + '")'))
|
|
84
|
+
.pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/qs.*?)\)/, 'concat("/resources/styles/components/footer/' + fileNames.qsFooterStylesFileName + '")'))
|
|
85
|
+
.pipe(gulp.dest(defaultSettings.publicFolder + '/resources/scripts/footer'))
|
|
86
|
+
.on('finish', resolve);
|
|
87
|
+
});
|
|
73
88
|
}
|
|
74
89
|
}
|
|
75
90
|
|
|
@@ -203,13 +218,13 @@ function getResource(task, fileNames, resourcePath = 'quote/resources') {
|
|
|
203
218
|
})
|
|
204
219
|
});
|
|
205
220
|
})
|
|
206
|
-
.then(() => {
|
|
221
|
+
.then(async () => {
|
|
207
222
|
if (!srcReplaceFn) {
|
|
208
223
|
return false;
|
|
209
224
|
}
|
|
210
225
|
|
|
211
226
|
if (typeof srcReplaceFn === 'function') {
|
|
212
|
-
srcReplaceFn(gulp, task.config.defaultSettings, task.config.config);
|
|
227
|
+
await srcReplaceFn(gulp, task.config.defaultSettings, task.config.config);
|
|
213
228
|
}
|
|
214
229
|
return true
|
|
215
230
|
})
|