mod-build 3.6.44-beta.1 → 3.6.44-beta.3
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/gulp-tasks/build.js
CHANGED
|
@@ -5,15 +5,15 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
5
5
|
var sequenceOpts;
|
|
6
6
|
|
|
7
7
|
if (siteData.useTypescript) {
|
|
8
|
-
sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'compile-prod', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'copy-resources-to-dist', 'build-stat'];
|
|
8
|
+
sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'compile-prod', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'handle-path-subdirectories', 'copy-resources-to-dist', 'build-stat'];
|
|
9
9
|
} else if (siteData.isWhiteLabel) {
|
|
10
10
|
if (siteData.isQSPage) {
|
|
11
|
-
sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'grab-theme-json', 'combine-files', 'grab-images', 'copy-json', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'copy-files-to-build-path', 'cache-bust', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
|
|
11
|
+
sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'grab-theme-json', 'combine-files', 'grab-images', 'copy-json', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'copy-files-to-build-path', 'cache-bust', 'handle-path-subdirectories', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
|
|
12
12
|
} else {
|
|
13
|
-
sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'combine-files', 'grab-images', 'js-lint', 'html-min','grab-global-images', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
|
|
13
|
+
sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'combine-files', 'grab-images', 'js-lint', 'html-min','grab-global-images', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'handle-path-subdirectories', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
|
|
14
14
|
}
|
|
15
15
|
} else {
|
|
16
|
-
sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'copy-resources-to-dist', 'build-stat'];
|
|
16
|
+
sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'handle-path-subdirectories', 'copy-resources-to-dist', 'build-stat'];
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
runSequence(...sequenceOpts, function() {
|
|
@@ -19,16 +19,17 @@ const fileNames = {
|
|
|
19
19
|
};
|
|
20
20
|
var isQuotePageOrUseRelativePath = false;
|
|
21
21
|
var resourceURL = '';
|
|
22
|
+
var pathSubdirectory = '';
|
|
22
23
|
|
|
23
24
|
function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
24
|
-
const resourcePath = isQuotePageOrUseRelativePath ?
|
|
25
|
+
const resourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}{{#if this.src}}{{this.src}}{{/if}}resources/scripts/mod-alytics/` : '/resources/scripts/mod-alytics/';
|
|
25
26
|
return gulp.src(siteSettings.srcFolder + '/shared-components/head/head.html')
|
|
26
27
|
.pipe(replace(/".*(modalytics).*"/, `"${resourcePath}${fileNames.modAlyticsFileName}"`))
|
|
27
28
|
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/head'));
|
|
28
29
|
}
|
|
29
30
|
function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
|
|
30
31
|
console.log('>> STARTING Replacing Foot Asset Scripts');
|
|
31
|
-
const resourcePath = isQuotePageOrUseRelativePath ?
|
|
32
|
+
const resourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}{{#if this.nodeModulesPath}}{{this.nodeModulesPath}}{{/if}}resources/scripts` : '/resources/scripts';
|
|
32
33
|
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
33
34
|
.pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"|"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"|"(?:(?!"|")[\s\S])+(mod-form\/mod-form.*?)js"|"(?:(?!"|")[\s\S])+(qs-form.*?)js"|"(?:(?!"|")[\s\S])+(mod-form\/form.*?)js"/g, function(match) {
|
|
34
35
|
if (match.includes('mod-form')) {
|
|
@@ -51,8 +52,8 @@ function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
function replaceAbandonmentJsCssSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
54
|
-
const jsResourcePath = isQuotePageOrUseRelativePath ?
|
|
55
|
-
const cssResourcePath = isQuotePageOrUseRelativePath ?
|
|
55
|
+
const jsResourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}resources/scripts/abandonment/` : '/resources/scripts/abandonment/';
|
|
56
|
+
const cssResourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}resources/styles/components/abandonment/` : '/resources/styles/components/abandonment/';
|
|
56
57
|
return gulp.src(siteSettings.srcFolder + '/templates/abandonment/*.html')
|
|
57
58
|
.pipe(replace(/"(?:(?!"|")[\s\S])+(abandonment\/abandonment.*?)js"/, `"${jsResourcePath}${fileNames.abandonmentJsFileName}"`))
|
|
58
59
|
.pipe(replace(/"(?:(?!"|")[\s\S])+(components\/abandonment\/abandonment.*?)css"/, `"${cssResourcePath}${fileNames.abandonmentStylesFileName}"`))
|
|
@@ -61,8 +62,8 @@ function replaceAbandonmentJsCssSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
61
62
|
function replaceFooterStylesReference(gulp, gulpPlugins, siteSettings, siteData) {
|
|
62
63
|
if (siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
63
64
|
return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/' + fileNames.footerComponentJsFileName)
|
|
64
|
-
.pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/mod.*?)\)/,
|
|
65
|
-
.pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/qs.*?)\)/,
|
|
65
|
+
.pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/mod.*?)\)/, `concat("${pathSubdirectory}resources/styles/components/footer/` + fileNames.modFooterStylesFileName + '")'))
|
|
66
|
+
.pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/qs.*?)\)/, `concat("${pathSubdirectory}resources/styles/components/footer/` + fileNames.qsFooterStylesFileName + '")'))
|
|
66
67
|
.pipe(gulp.dest(siteSettings.srcFolder + '/resources/scripts/footer'))
|
|
67
68
|
} else if (!siteData.siteData || siteData.siteData && !siteData.siteData.isQuotePage) {
|
|
68
69
|
return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/' + fileNames.footerComponentJsFileName)
|
|
@@ -74,8 +75,8 @@ function replaceFooterStylesReference(gulp, gulpPlugins, siteSettings, siteData)
|
|
|
74
75
|
function replaceFooterStylesReferenceInMap(gulp, gulpPlugins, siteSettings, siteData) {
|
|
75
76
|
if (siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
76
77
|
return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/footer-component.min.js.map')
|
|
77
|
-
.pipe(replace(/\`(?:(?!\`|\`)[\s\S])+(components\/footer\/mod.*?)\`/, '`resources/styles/components/footer/' + fileNames.modFooterStylesFileName + '`'))
|
|
78
|
-
.pipe(replace(/\`(?:(?!\`|\`)[\s\S])+(components\/footer\/mod.*?)\`/, '`resources/styles/components/footer/' + fileNames.qsFooterStylesFileName + '`'))
|
|
78
|
+
.pipe(replace(/\`(?:(?!\`|\`)[\s\S])+(components\/footer\/mod.*?)\`/, '`' + pathSubdirectory + 'resources/styles/components/footer/' + fileNames.modFooterStylesFileName + '`'))
|
|
79
|
+
.pipe(replace(/\`(?:(?!\`|\`)[\s\S])+(components\/footer\/mod.*?)\`/, '`' + pathSubdirectory + 'resources/styles/components/footer/' + fileNames.qsFooterStylesFileName + '`'))
|
|
79
80
|
.pipe(gulp.dest(siteSettings.srcFolder + '/resources/scripts/footer'));
|
|
80
81
|
} else if (!siteData.siteData || siteData.siteData && !siteData.siteData.isQuotePage) {
|
|
81
82
|
return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/footer-component.min.js.map')
|
|
@@ -248,10 +249,12 @@ const TASKS = {
|
|
|
248
249
|
}
|
|
249
250
|
};
|
|
250
251
|
module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
252
|
+
const { isLocal } = siteSettings
|
|
251
253
|
const isQuotePage = siteData.siteData && siteData.siteData.isQuotePage || siteData && siteData.isQuotePage;
|
|
252
254
|
const useRelativePathForResources = siteData.siteData && siteData.siteData.useRelativePathForResources || siteData && siteData.useRelativePathForResources;
|
|
253
255
|
isQuotePageOrUseRelativePath = isQuotePage === true || useRelativePathForResources === true;
|
|
254
256
|
resourceURL = `https://${siteSettings.nodeEnv}/quote/resources`;
|
|
257
|
+
pathSubdirectory = isLocal ? '' : siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory;
|
|
255
258
|
return function() {
|
|
256
259
|
const { nodeEnv } = siteSettings;
|
|
257
260
|
if (!nodeEnv) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var replace = require('gulp-replace');
|
|
2
|
+
|
|
3
|
+
module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
4
|
+
if (siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory) {
|
|
5
|
+
const pathSubdirectory = siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory;
|
|
6
|
+
|
|
7
|
+
console.log(pathSubdirectory);
|
|
8
|
+
|
|
9
|
+
return gulp.src(siteSettings.distFolder + '/**/*.html')
|
|
10
|
+
.pipe(replace(/((src="|href=")(images|resources|scripts|styles|shared-components)\/[^"]+")/g, function(match, path) {
|
|
11
|
+
if (path.startsWith('src="images') || path.startsWith('src="resources') || path.startsWith('src="scripts') || path.startsWith('src="shared-components') || path.startsWith('href="styles') || path.startsWith('href="shared-components')) {
|
|
12
|
+
return path + '/spn/"';
|
|
13
|
+
}
|
|
14
|
+
return match;
|
|
15
|
+
}))
|
|
16
|
+
.pipe(gulp.dest(siteSettings.distFolder));
|
|
17
|
+
}
|
|
18
|
+
};
|
package/gulp-tasks/tasks.js
CHANGED
|
@@ -360,7 +360,7 @@ module.exports = function() {
|
|
|
360
360
|
|
|
361
361
|
return require(opts.gulpTasksFolderPath + '/grab-images')(opts.gulp, opts.gulpSettings, opts.siteData);
|
|
362
362
|
}
|
|
363
|
-
|
|
363
|
+
},
|
|
364
364
|
|
|
365
365
|
// Get global images
|
|
366
366
|
'grab-global-images': {
|
|
@@ -432,7 +432,7 @@ module.exports = function() {
|
|
|
432
432
|
|
|
433
433
|
return require(opts.gulpTasksFolderPath + '/grab-tooltips-json')(opts.gulp, opts.gulpPlugins, opts.gulpSettings, opts.siteData);
|
|
434
434
|
}
|
|
435
|
-
|
|
435
|
+
},
|
|
436
436
|
|
|
437
437
|
// copy resources directory into dist
|
|
438
438
|
'copy-resources-to-dist': {
|
|
@@ -446,6 +446,18 @@ module.exports = function() {
|
|
|
446
446
|
}
|
|
447
447
|
},
|
|
448
448
|
|
|
449
|
+
// If siteData.pathSubdirectory exists...append the directory path to all of the existing relative URL paths
|
|
450
|
+
'handle-path-subdirectories': {
|
|
451
|
+
subtasks: [],
|
|
452
|
+
func: function(opts) {
|
|
453
|
+
if ('undefined' === typeof opts.gulpTasksFolderPath) {
|
|
454
|
+
opts.gulpTasksFolderPath = '.';
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
return require(opts.gulpTasksFolderPath + '/handle-path-subdirectories')(opts.gulp, opts.gulpPlugins, opts.gulpSettings, opts.siteData);
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
|
|
449
461
|
// Create a build
|
|
450
462
|
'build': {
|
|
451
463
|
func: function(opts) {
|