mod-build 3.6.44 → 3.6.46
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.6.46
|
|
4
|
+
|
|
5
|
+
- Added one condition for pathSubdirectory variable to resolve a bug (CRO-3185) . Also Made little updates on add-path-subdirectories to make the code more DRY
|
|
6
|
+
|
|
7
|
+
## 3.6.45
|
|
8
|
+
|
|
9
|
+
- Added `add-path-subdirectories` task. If `siteData.pathSubdirectory` exists at a site level, it will get the value & append the path to all of the existing RELATIVE paths (build task only – doesn't run on gulp serve). Also updated `grab-shared-scripts` to include the `pathSubdirectory` in the replacement paths during `build` if it exists.
|
|
10
|
+
|
|
3
11
|
## 3.6.44
|
|
4
12
|
|
|
5
13
|
- Added a `grab-form-helpers` task
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var replace = require('gulp-replace');
|
|
2
|
+
|
|
3
|
+
module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
4
|
+
return function() {
|
|
5
|
+
const isPathSubdirectory = siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory;
|
|
6
|
+
if (isPathSubdirectory) {
|
|
7
|
+
const pathSubdirectory = isPathSubdirectory;
|
|
8
|
+
|
|
9
|
+
return gulp.src(siteSettings.distFolder + '/**/*.html')
|
|
10
|
+
.pipe(replace(/(href="favicon.ico")/g, function(match, path) {
|
|
11
|
+
return `href="${pathSubdirectory}favicon.ico"`;
|
|
12
|
+
}))
|
|
13
|
+
.pipe(replace(/((src=")(images|scripts|shared-components)\/[^"]+")/g, function(match, path) {
|
|
14
|
+
if (path.startsWith('src="images') || path.startsWith('src="scripts') || path.startsWith('src="shared-components')) {
|
|
15
|
+
return `src="${pathSubdirectory}${path.slice(5)}`;
|
|
16
|
+
}
|
|
17
|
+
return match;
|
|
18
|
+
}))
|
|
19
|
+
.pipe(replace(/((href=")(images|styles|shared-components)\/[^"]+")/g, function(match, path) {
|
|
20
|
+
if (path.startsWith('href="images') || path.startsWith('href="styles') || path.startsWith('href="shared-components')) {
|
|
21
|
+
return `href="${pathSubdirectory}${path.slice(6)}`;
|
|
22
|
+
}
|
|
23
|
+
return match;
|
|
24
|
+
}))
|
|
25
|
+
.pipe(gulp.dest(siteSettings.distFolder));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
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', 'add-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', 'add-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', 'add-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', 'add-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,13 @@ 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
|
+
const isPathSubdirectory = siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory;
|
|
258
|
+
pathSubdirectory = !isLocal && isPathSubdirectory ? isPathSubdirectory : '';
|
|
255
259
|
return function() {
|
|
256
260
|
const { nodeEnv } = siteSettings;
|
|
257
261
|
if (!nodeEnv) {
|
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
|
+
'add-path-subdirectories': {
|
|
451
|
+
subtasks: [],
|
|
452
|
+
func: function(opts) {
|
|
453
|
+
if ('undefined' === typeof opts.gulpTasksFolderPath) {
|
|
454
|
+
opts.gulpTasksFolderPath = '.';
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
return require(opts.gulpTasksFolderPath + '/add-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) {
|