mod-build 4.0.102 → 4.0.104
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 +7 -2
- package/package.json +1 -1
- package/src/scripts/globals.js +1 -3
- package/src/scripts/plugins.js +0 -3
- package/tasks/templates.js +2 -4
- package/gulp-tasks/add-path-subdirectories.js +0 -34
- package/gulp-tasks/build-stat.js +0 -9
- package/gulp-tasks/build.js +0 -28
- package/gulp-tasks/cache-bust.js +0 -19
- package/gulp-tasks/check-seasonal-variations.js +0 -21
- package/gulp-tasks/clean.js +0 -10
- package/gulp-tasks/combine-files.js +0 -7
- package/gulp-tasks/compile.js +0 -44
- package/gulp-tasks/copy-files-to-build-path.js +0 -8
- package/gulp-tasks/copy-fonts.js +0 -6
- package/gulp-tasks/copy-json.js +0 -6
- package/gulp-tasks/copy-resources-to-dist.js +0 -6
- package/gulp-tasks/copy-videos.js +0 -6
- package/gulp-tasks/extras.js +0 -22
- package/gulp-tasks/grab-cdn.js +0 -74
- package/gulp-tasks/grab-form-helpers.js +0 -55
- package/gulp-tasks/grab-global-images.js +0 -121
- package/gulp-tasks/grab-images.js +0 -79
- package/gulp-tasks/grab-shared-components.js +0 -46
- package/gulp-tasks/grab-shared-scripts.js +0 -275
- package/gulp-tasks/grab-theme-json.js +0 -24
- package/gulp-tasks/grab-tooltips-json.js +0 -33
- package/gulp-tasks/js-lint-husky.js +0 -35
- package/gulp-tasks/js-lint.js +0 -24
- package/gulp-tasks/minify.js +0 -131
- package/gulp-tasks/sass-lint.js +0 -15
- package/gulp-tasks/serve.js +0 -74
- package/gulp-tasks/settings.js +0 -22
- package/gulp-tasks/styles.js +0 -42
- package/gulp-tasks/tasks.js +0 -475
- package/gulp-tasks/templates.js +0 -288
- package/src/data/footer.js +0 -119
- package/src/resources/data/tcpa.json +0 -4
- package/src/resources/templates/modals/about/index.hbs +0 -9
- package/src/resources/templates/modals/about/index.html +0 -9
- package/src/resources/templates/modals/contact-us/index.hbs +0 -348
- package/src/resources/templates/modals/contact-us/index.html +0 -348
- package/src/resources/templates/modals/e-sign-consent/index.hbs +0 -35
- package/src/resources/templates/modals/e-sign-consent/index.html +0 -35
- package/src/resources/templates/modals/faq/index.hbs +0 -9
- package/src/resources/templates/modals/faq/index.html +0 -9
- package/src/resources/templates/modals/privacy/index.hbs +0 -238
- package/src/resources/templates/modals/privacy/index.html +0 -238
- package/src/resources/templates/modals/terms/index.hbs +0 -166
- package/src/resources/templates/modals/terms/index.html +0 -166
- package/src/scripts/default/additional-assets.js +0 -60
- package/src/scripts/default/rage-clicking.js +0 -54
- package/src/scripts/default/show-utility-providers.js +0 -28
- package/src/scripts/url-cleaner.js +0 -8
- package/src/scripts/vendor/google-tag-manager-head.js +0 -6
- package/src/scripts/vendor/heap-addeventproperties-identify.js +0 -262
- package/src/scripts/vendor/heap-tracking.js +0 -9
- package/src/styles/partials/_contact-us.scss +0 -196
- package/src/styles/partials/_google-address-autocomplete.scss +0 -52
- package/src/styles/partials/_mixins.scss +0 -39
- package/src/styles/partials/_modal-pages.scss +0 -125
- package/src/styles/partials/_modernize-colors.scss +0 -128
- package/src/styles/partials/_qs-footer.scss +0 -68
- package/src/styles/partials/_quote-footer-v1.scss +0 -79
- package/src/styles/partials/_quote-footer-v2.scss +0 -64
- package/src/styles/partials/_quote-footer-v3.scss +0 -65
- package/src/templates/_partials/scripts/deferred-styles.html +0 -16
- package/src/templates/_partials/scripts/heap-bundle.html +0 -5
- package/src/templates/_partials/scripts/heap.html +0 -4
- package/src/templates/_partials/scripts/utm-params.html +0 -9
- package/src/templates/components/qs-footer.html +0 -55
- package/src/templates/components/quote-footer-v1.html +0 -148
- package/src/templates/components/quote-footer-v2.html +0 -169
- /package/tasks/{addSeasonalchanges.js → add-seasonal-changes.js} +0 -0
- /package/tasks/{setupDevOpsTrackingId.js → setup-dev-ops-tracking-id.js} +0 -0
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
var fs = require('fs');
|
|
2
|
-
var request = require('request');
|
|
3
|
-
var source = require('vinyl-source-stream');
|
|
4
|
-
|
|
5
|
-
function streamToDestination(gulp, siteSettings, externalPath, fileName, destPath) {
|
|
6
|
-
return new Promise(resolve => { // eslint-disable-line no-undef
|
|
7
|
-
request(`https://${siteSettings.nodeEnv}/quote/resources/assets/images/${externalPath}`)
|
|
8
|
-
.on('response', resp => {
|
|
9
|
-
if (resp.statusCode !== 200 && resp.statusCode !== 206) {
|
|
10
|
-
throw new Error(`${resp.statusCode} Error while fetching ${fileName}`);
|
|
11
|
-
}
|
|
12
|
-
})
|
|
13
|
-
.pipe(source(fileName))
|
|
14
|
-
.pipe(gulp.dest(`${siteSettings.srcFolder}/${destPath}`))
|
|
15
|
-
.on('finish', resolve);
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const getTags = (string) => {
|
|
20
|
-
const regExs = [/<img.*?src="(.*?)"[^\>]+>/g, /<use.*?href="(.*?)".*?>/g, /<source.*?srcset="(.*?)".*?>/g, /url\('#{\$path}.*?'\)/g];
|
|
21
|
-
let tags = [];
|
|
22
|
-
|
|
23
|
-
regExs.forEach((regEx) => {
|
|
24
|
-
const match = string.match(regEx);
|
|
25
|
-
|
|
26
|
-
if (match) {
|
|
27
|
-
tags = [...tags, ...match];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
return tags;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const getUrls = (tags) => {
|
|
35
|
-
const urls = [];
|
|
36
|
-
|
|
37
|
-
tags.forEach((tag) => {
|
|
38
|
-
const isHTML = tag.indexOf('{{assetsPath}}');
|
|
39
|
-
const isCSS = tag.indexOf('url(\'#{$path}');
|
|
40
|
-
const varName = isHTML > -1 ? '{{assetsPath}}' : 'url(\'#{$path}';
|
|
41
|
-
|
|
42
|
-
if (isHTML > -1 || isCSS > -1) {
|
|
43
|
-
let url = tag;
|
|
44
|
-
|
|
45
|
-
if (isHTML > -1) {
|
|
46
|
-
url = url.slice(tag.indexOf(varName));
|
|
47
|
-
url = url.indexOf('#') > -1 ? url.slice(0, url.indexOf('#')) : url.slice(0, url.indexOf('"'));
|
|
48
|
-
} else {
|
|
49
|
-
url = url.replace('\')', '');
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
url = url.replace(`${varName}/images/`, '');
|
|
53
|
-
urls.push(url);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
return [...new Set(urls)]; // eslint-disable-line no-undef
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const parseImageSources = (gulp, siteSettings) => {
|
|
61
|
-
const text = fs.readFileSync(`${siteSettings.tmpFolder}/all.txt`, 'utf8');
|
|
62
|
-
const textMatches = getTags(text);
|
|
63
|
-
return getUrls(textMatches);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
module.exports = function(gulp, siteSettings, siteData) {
|
|
67
|
-
return function() {
|
|
68
|
-
const { isWhiteLabel } = siteData;
|
|
69
|
-
const urls = parseImageSources(gulp, siteSettings);
|
|
70
|
-
const ouputPath = isWhiteLabel ? 'images/' : 'temp/assets/images/';
|
|
71
|
-
const urlsPromises = urls.map((url) => {
|
|
72
|
-
const fileName = url.slice(url.lastIndexOf('/') + 1);
|
|
73
|
-
const relativePath = ouputPath + url.replace(fileName, '');
|
|
74
|
-
return streamToDestination(gulp, siteSettings, url, fileName, relativePath);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
return Promise.all(urlsPromises); // eslint-disable-line no-undef
|
|
78
|
-
};
|
|
79
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
var request = require('request');
|
|
2
|
-
var source = require('vinyl-source-stream');
|
|
3
|
-
|
|
4
|
-
function streamSharedCompsToDestination(gulp, siteSettings, folder, fileName) {
|
|
5
|
-
return new Promise(resolve => {
|
|
6
|
-
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/${fileName}`)
|
|
7
|
-
.on('response', resp => {
|
|
8
|
-
if (resp.statusCode !== 200) {
|
|
9
|
-
throw new Error(`${resp.statusCode} Error while fetching ${fileName}`);
|
|
10
|
-
}
|
|
11
|
-
})
|
|
12
|
-
.pipe(source(fileName))
|
|
13
|
-
.pipe(gulp.dest(`${siteSettings.srcFolder}/${folder}/`))
|
|
14
|
-
.on('finish', resolve);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function getListOfSharedComponents(gulp, gulpPlugins, siteSettings, componentFolders) {
|
|
19
|
-
return componentFolders.map(folder => {
|
|
20
|
-
return new Promise(resolve => {
|
|
21
|
-
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/all.json`, function(err, resp, body) {
|
|
22
|
-
if (resp.statusCode !== 200) {
|
|
23
|
-
throw new Error(`${resp.statusCode}: Error while fetching ${folder}/all.json`);
|
|
24
|
-
}
|
|
25
|
-
var listOfComponents = JSON.parse(body);
|
|
26
|
-
const componentPromises = listOfComponents.map(function(resource) {
|
|
27
|
-
return streamSharedCompsToDestination(gulp, siteSettings, folder, `${resource}`);
|
|
28
|
-
});
|
|
29
|
-
resolve(Promise.all(componentPromises));
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
module.exports = function(gulp, gulpPlugins, siteSettings) {
|
|
36
|
-
return function() {
|
|
37
|
-
const { nodeEnv } = siteSettings;
|
|
38
|
-
if (!nodeEnv) {
|
|
39
|
-
throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const componentFolders = ['shared-components', 'accessible-components']
|
|
43
|
-
|
|
44
|
-
return getListOfSharedComponents(gulp, gulpPlugins, siteSettings, componentFolders);
|
|
45
|
-
};
|
|
46
|
-
};
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
var request = require('request');
|
|
2
|
-
var source = require('vinyl-source-stream');
|
|
3
|
-
var replace = require('gulp-replace');
|
|
4
|
-
var hash = require('gulp-hash');
|
|
5
|
-
var tap = require('gulp-tap');
|
|
6
|
-
var path = require('path');
|
|
7
|
-
var buffer = require('gulp-buffer');
|
|
8
|
-
|
|
9
|
-
const fileNames = {
|
|
10
|
-
modAlyticsFileName: '',
|
|
11
|
-
modUtilsFileName: '',
|
|
12
|
-
abandonmentJsFileName: '',
|
|
13
|
-
footerComponentJsFileName: '',
|
|
14
|
-
modFooterStylesFileName: '',
|
|
15
|
-
qsFooterStylesFileName: '',
|
|
16
|
-
homeownerFormFileName: '',
|
|
17
|
-
callrailFileName: ''
|
|
18
|
-
};
|
|
19
|
-
var isQuotePageOrUseRelativePath = false;
|
|
20
|
-
var resourceURL = '';
|
|
21
|
-
var pathSubdirectory = '';
|
|
22
|
-
var componentFolderPath = '';
|
|
23
|
-
|
|
24
|
-
function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
25
|
-
const resourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}{{#if this.src}}{{this.src}}{{/if}}resources/scripts/mod-alytics/` : '/resources/scripts/mod-alytics/';
|
|
26
|
-
return gulp.src(`${siteSettings.srcFolder}/${componentFolderPath}/head/head.html`)
|
|
27
|
-
.pipe(replace(/".*(modalytics).*"/, `"${resourcePath}${fileNames.modAlyticsFileName}"`))
|
|
28
|
-
.pipe(gulp.dest(`${siteSettings.srcFolder}/${componentFolderPath}/head`));
|
|
29
|
-
}
|
|
30
|
-
function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
|
|
31
|
-
const resourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}{{#if this.nodeModulesPath}}{{this.nodeModulesPath}}{{/if}}resources/scripts` : '/resources/scripts';
|
|
32
|
-
return gulp.src(`${siteSettings.srcFolder}/${componentFolderPath}/foot-assets/foot-assets.html`)
|
|
33
|
-
.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) {
|
|
34
|
-
if (match.includes('mod-form/form')) {
|
|
35
|
-
return `"${resourcePath}/mod-form/form/${fileNames.homeownerFormFileName}"`;
|
|
36
|
-
} else if (match.includes('callrail')) {
|
|
37
|
-
return `"${resourcePath}/callrail/${fileNames.callrailFileName}"`;
|
|
38
|
-
} else if (match.includes('modutils') || match.includes('mod-utils')) {
|
|
39
|
-
return `"${resourcePath}/mod-utils/${fileNames.modUtilsFileName}"`;
|
|
40
|
-
} else if (match.includes('footer-component')) {
|
|
41
|
-
return `"${resourcePath}/footer/${fileNames.footerComponentJsFileName}"`;
|
|
42
|
-
}
|
|
43
|
-
}))
|
|
44
|
-
.pipe(gulp.dest(`${siteSettings.srcFolder}/${componentFolderPath}/foot-assets`))
|
|
45
|
-
.on('end', function() {
|
|
46
|
-
console.log('>> FINISHED replacing foot asset scripts');
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
function replaceAbandonmentJsCssSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
50
|
-
const jsResourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}resources/scripts/abandonment/` : '/resources/scripts/abandonment/';
|
|
51
|
-
const cssResourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}resources/styles/components/abandonment/` : '/resources/styles/components/abandonment/';
|
|
52
|
-
return gulp.src(siteSettings.srcFolder + '/templates/abandonment/*.html')
|
|
53
|
-
.pipe(replace(/"(?:(?!"|")[\s\S])+(abandonment\/abandonment.*?)js"/, `"${jsResourcePath}${fileNames.abandonmentJsFileName}"`))
|
|
54
|
-
.pipe(replace(/"(?:(?!"|")[\s\S])+(components\/abandonment\/abandonment.*?)css"/, `"${cssResourcePath}${fileNames.abandonmentStylesFileName}"`))
|
|
55
|
-
.pipe(gulp.dest(siteSettings.srcFolder + '/templates/abandonment'));
|
|
56
|
-
}
|
|
57
|
-
function replaceFooterStylesReference(gulp, gulpPlugins, siteSettings, siteData) {
|
|
58
|
-
if (siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
59
|
-
return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/' + fileNames.footerComponentJsFileName)
|
|
60
|
-
.pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/mod.*?)\)/, `concat("${pathSubdirectory}resources/styles/components/footer/` + fileNames.modFooterStylesFileName + '")'))
|
|
61
|
-
.pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/qs.*?)\)/, `concat("${pathSubdirectory}resources/styles/components/footer/` + fileNames.qsFooterStylesFileName + '")'))
|
|
62
|
-
.pipe(gulp.dest(siteSettings.srcFolder + '/resources/scripts/footer'))
|
|
63
|
-
} else if (!siteData.siteData || siteData.siteData && !siteData.siteData.isQuotePage) {
|
|
64
|
-
return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/' + fileNames.footerComponentJsFileName)
|
|
65
|
-
.pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/mod.*?)\)/, 'concat("/resources/styles/components/footer/' + fileNames.modFooterStylesFileName + '")'))
|
|
66
|
-
.pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/qs.*?)\)/, 'concat("/resources/styles/components/footer/' + fileNames.qsFooterStylesFileName + '")'))
|
|
67
|
-
.pipe(gulp.dest(siteSettings.srcFolder + '/resources/scripts/footer'))
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function replaceFooterStylesReferenceInMap(gulp, gulpPlugins, siteSettings, siteData) {
|
|
71
|
-
if (siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
72
|
-
return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/footer-component.min.js.map')
|
|
73
|
-
.pipe(replace(/\`(?:(?!\`|\`)[\s\S])+(components\/footer\/mod.*?)\`/, '`' + pathSubdirectory + 'resources/styles/components/footer/' + fileNames.modFooterStylesFileName + '`'))
|
|
74
|
-
.pipe(replace(/\`(?:(?!\`|\`)[\s\S])+(components\/footer\/mod.*?)\`/, '`' + pathSubdirectory + 'resources/styles/components/footer/' + fileNames.qsFooterStylesFileName + '`'))
|
|
75
|
-
.pipe(gulp.dest(siteSettings.srcFolder + '/resources/scripts/footer'));
|
|
76
|
-
} else if (!siteData.siteData || siteData.siteData && !siteData.siteData.isQuotePage) {
|
|
77
|
-
return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/footer-component.min.js.map')
|
|
78
|
-
.pipe(replace(/\`(?:(?!\`|\`)[\s\S])+(components\/footer\/mod.*?)\`/, '`/resources/styles/components/footer/' + fileNames.modFooterStylesFileName + '`'))
|
|
79
|
-
.pipe(replace(/\`(?:(?!\`|\`)[\s\S])+(components\/footer\/mod.*?)\`/, '`/resources/styles/components/footer/' + fileNames.qsFooterStylesFileName + '`'))
|
|
80
|
-
.pipe(gulp.dest(siteSettings.srcFolder + '/resources/scripts/footer'));
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function getFileFromURL(url) {
|
|
84
|
-
return url.split('/').pop();
|
|
85
|
-
}
|
|
86
|
-
function getResource(url, config = {}, fn, fnArray) {
|
|
87
|
-
if (Object.keys(config).length === 0) {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return new Promise(resolve => {
|
|
92
|
-
const file = getFileFromURL(url);
|
|
93
|
-
request(`${resourceURL}/${url}`)
|
|
94
|
-
.on('response', resp => {
|
|
95
|
-
if (resp.statusCode !== 200) {
|
|
96
|
-
throw new Error(`${resp.statusCode} Error while fetching ${file}`);
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
.pipe(source(file))
|
|
100
|
-
.pipe(buffer())
|
|
101
|
-
.pipe(hash({
|
|
102
|
-
hashLength: 20,
|
|
103
|
-
algorithm: 'md5',
|
|
104
|
-
template: file.replace(/^([^.]*)\.(.*)$/, '$1-<%= hash %>.$2')
|
|
105
|
-
}))
|
|
106
|
-
.pipe(tap(function(file, t) {
|
|
107
|
-
fileNames[config.fileName] = path.basename(file.path);
|
|
108
|
-
}))
|
|
109
|
-
.pipe(config.gulp.dest(`${config.siteSettings.srcFolder}/resources/${config.dest}`))
|
|
110
|
-
.on('finish', function(){
|
|
111
|
-
resolve();
|
|
112
|
-
});
|
|
113
|
-
})
|
|
114
|
-
.then(() => {
|
|
115
|
-
if (!config.mapUrl) { return false };
|
|
116
|
-
const file = getFileFromURL(config.mapUrl);
|
|
117
|
-
return new Promise((resolve) => {
|
|
118
|
-
request(`${resourceURL}/${config.mapUrl}`)
|
|
119
|
-
.on('response', (resp) => {
|
|
120
|
-
if (resp.statusCode !== 200) {
|
|
121
|
-
throw new Error(`${resp.statusCode} Error while fetching ${file}`);
|
|
122
|
-
} else {
|
|
123
|
-
if (typeof fn === 'function') {
|
|
124
|
-
fn.call(null, config.gulp, config.gulpSettings, config.siteSettings, config.siteData);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
})
|
|
128
|
-
.pipe(source(file))
|
|
129
|
-
.pipe(config.gulp.dest(`${config.siteSettings.srcFolder}/resources/${config.dest}`))
|
|
130
|
-
.on('finish', function(){
|
|
131
|
-
resolve();
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
})
|
|
135
|
-
.then(() => {
|
|
136
|
-
if (fnArray && fnArray.length) {
|
|
137
|
-
fnArray.map(function(fn) {
|
|
138
|
-
if (typeof fn === 'function') {
|
|
139
|
-
fn.call(null, config.gulp, config.gulpSettings, config.siteSettings, config.siteData)
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
const TASKS = {
|
|
146
|
-
copyCallrail: {
|
|
147
|
-
url: 'shared-resources/scripts/callrail/callrail.min.js',
|
|
148
|
-
config: {
|
|
149
|
-
fileName: 'callrailFileName',
|
|
150
|
-
dest: 'scripts/callrail',
|
|
151
|
-
mapUrl: 'shared-resources/scripts/callrail/callrail.min.js.map',
|
|
152
|
-
},
|
|
153
|
-
srcReplaceFn: null,
|
|
154
|
-
additionalSrcReplaceFns: []
|
|
155
|
-
},
|
|
156
|
-
copyModutils: {
|
|
157
|
-
url: 'mod-utils/modutils.min.js',
|
|
158
|
-
config: {
|
|
159
|
-
fileName: 'modUtilsFileName',
|
|
160
|
-
dest: 'scripts/mod-utils',
|
|
161
|
-
mapUrl: 'mod-utils/modutils.min.js.map',
|
|
162
|
-
},
|
|
163
|
-
srcReplaceFn: null,
|
|
164
|
-
additionalSrcReplaceFns: []
|
|
165
|
-
},
|
|
166
|
-
copyFooterComponentJs: {
|
|
167
|
-
url: 'shared-resources/scripts/footer/footer-component.min.js',
|
|
168
|
-
config: {
|
|
169
|
-
fileName: 'footerComponentJsFileName',
|
|
170
|
-
dest: 'scripts/footer',
|
|
171
|
-
mapUrl: 'shared-resources/scripts/footer/footer-component.min.js.map',
|
|
172
|
-
},
|
|
173
|
-
srcReplaceFn: null,
|
|
174
|
-
additionalSrcReplaceFns: []
|
|
175
|
-
},
|
|
176
|
-
copyHomeownerForm: {
|
|
177
|
-
url: 'mod-form/form/homeowner.min.js',
|
|
178
|
-
config: {
|
|
179
|
-
fileName: 'homeownerFormFileName',
|
|
180
|
-
dest: 'scripts/mod-form/form',
|
|
181
|
-
mapUrl: 'mod-form/form/homeowner.min.js.map',
|
|
182
|
-
},
|
|
183
|
-
srcReplaceFn: replaceFootAssetScripts,
|
|
184
|
-
additionalSrcReplaceFns: []
|
|
185
|
-
},
|
|
186
|
-
copyModalytics: {
|
|
187
|
-
url: 'mod-alytics/modalytics.min.js',
|
|
188
|
-
config: {
|
|
189
|
-
fileName: 'modAlyticsFileName',
|
|
190
|
-
dest: 'scripts/mod-alytics',
|
|
191
|
-
mapUrl: 'mod-alytics/modalytics.min.js.map',
|
|
192
|
-
},
|
|
193
|
-
srcReplaceFn: replaceModalyticsSrc,
|
|
194
|
-
additionalSrcReplaceFns: []
|
|
195
|
-
},
|
|
196
|
-
copyAbandonmentComponentStyles: {
|
|
197
|
-
url: 'shared-resources/styles/components/abandonment/abandonment.min.css',
|
|
198
|
-
config: {
|
|
199
|
-
fileName: 'abandonmentStylesFileName',
|
|
200
|
-
dest: 'styles/components/abandonment',
|
|
201
|
-
mapUrl: null,
|
|
202
|
-
},
|
|
203
|
-
srcReplaceFn: null,
|
|
204
|
-
additionalSrcReplaceFns: []
|
|
205
|
-
},
|
|
206
|
-
copyAbandonmentJs: {
|
|
207
|
-
url: 'shared-resources/scripts/abandonment/abandonment.min.js',
|
|
208
|
-
config: {
|
|
209
|
-
fileName: 'abandonmentJsFileName',
|
|
210
|
-
dest: 'scripts/abandonment',
|
|
211
|
-
mapUrl: 'shared-resources/scripts/abandonment/abandonment.min.js.map',
|
|
212
|
-
},
|
|
213
|
-
srcReplaceFn: replaceAbandonmentJsCssSrc,
|
|
214
|
-
additionalSrcReplaceFns: []
|
|
215
|
-
},
|
|
216
|
-
copyModFooterComponentStyles: {
|
|
217
|
-
url: 'shared-resources/styles/components/footer/mod-footer.min.css',
|
|
218
|
-
config: {
|
|
219
|
-
fileName: 'modFooterStylesFileName',
|
|
220
|
-
dest: 'styles/components/footer',
|
|
221
|
-
mapUrl: null,
|
|
222
|
-
},
|
|
223
|
-
srcReplaceFn: null,
|
|
224
|
-
additionalSrcReplaceFns: []
|
|
225
|
-
},
|
|
226
|
-
copyQsFooterComponentStyles: {
|
|
227
|
-
url: 'shared-resources/styles/components/footer/qs-footer.min.css',
|
|
228
|
-
config: {
|
|
229
|
-
fileName: 'qsFooterStylesFileName',
|
|
230
|
-
dest: 'styles/components/footer',
|
|
231
|
-
mapUrl: null,
|
|
232
|
-
},
|
|
233
|
-
srcReplaceFn: null,
|
|
234
|
-
additionalSrcReplaceFns: [replaceFooterStylesReference, replaceFooterStylesReferenceInMap]
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
238
|
-
const { isLocal } = siteSettings
|
|
239
|
-
const isQuotePage = siteData.siteData && siteData.siteData.isQuotePage || siteData && siteData.isQuotePage;
|
|
240
|
-
const useAccessibleComponents = siteData.siteData && siteData.siteData.useAccessibleConfig || siteData && siteData.useAccessibleConfig;
|
|
241
|
-
const useRelativePathForResources = siteData.siteData && siteData.siteData.useRelativePathForResources || siteData && siteData.useRelativePathForResources;
|
|
242
|
-
componentFolderPath = useAccessibleComponents === true ? 'accessible-components' : 'shared-components';
|
|
243
|
-
isQuotePageOrUseRelativePath = isQuotePage === true || useRelativePathForResources === true;
|
|
244
|
-
resourceURL = `https://${siteSettings.nodeEnv}/quote/resources`;
|
|
245
|
-
const isPathSubdirectory = siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory;
|
|
246
|
-
pathSubdirectory = !isLocal && isPathSubdirectory ? isPathSubdirectory : '';
|
|
247
|
-
|
|
248
|
-
return function() {
|
|
249
|
-
const { nodeEnv } = siteSettings;
|
|
250
|
-
if (!nodeEnv) {
|
|
251
|
-
throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
|
|
252
|
-
}
|
|
253
|
-
return (function() {
|
|
254
|
-
const tasks = Object.values(TASKS)
|
|
255
|
-
|
|
256
|
-
if (tasks.length) {
|
|
257
|
-
var getAllResources = tasks.map(function(task) {
|
|
258
|
-
if (useAccessibleComponents === true) {
|
|
259
|
-
if (task.url.includes('abandonment.min.js')) {
|
|
260
|
-
task.url = 'shared-resources/scripts/abandonment/accessible/abandonment.min.js';
|
|
261
|
-
task.config.mapUrl = 'shared-resources/scripts/abandonment/accessible/abandonment.min.js.map';
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
Object.assign(task.config, { gulp, gulpPlugins, siteSettings, siteData });
|
|
265
|
-
return getResource(task.url, task.config, task.srcReplaceFn, task.additionalSrcReplaceFns)
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
return Promise.all(getAllResources)
|
|
270
|
-
.then(() => {
|
|
271
|
-
console.log(`>> FILENAMES object = ${JSON.stringify(fileNames)}`);
|
|
272
|
-
})
|
|
273
|
-
}());
|
|
274
|
-
};
|
|
275
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var request = require('request');
|
|
2
|
-
var source = require('vinyl-source-stream');
|
|
3
|
-
|
|
4
|
-
// helper to allow us to define an "end" event to multiple streams
|
|
5
|
-
function streamToDestination(gulp, gulpPlugins, siteSettings, fileName) {
|
|
6
|
-
return new Promise(resolve => { // eslint-disable-line no-undef
|
|
7
|
-
request(`https://${siteSettings.nodeEnv}/quote/resources/data/themes/${fileName}.json`)
|
|
8
|
-
.on('response', resp => {
|
|
9
|
-
if (resp.statusCode !== 200) {
|
|
10
|
-
throw new Error(`${resp.statusCode}: Error while fetching ${fileName}.json`);
|
|
11
|
-
}
|
|
12
|
-
})
|
|
13
|
-
.pipe(source(fileName))
|
|
14
|
-
.pipe(gulpPlugins.rename('theme.json'))
|
|
15
|
-
.pipe(gulp.dest(`${siteSettings.srcFolder}/data`))
|
|
16
|
-
.on('finish', resolve);
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
21
|
-
return function() {
|
|
22
|
-
return streamToDestination(gulp, gulpPlugins, siteSettings, siteData.page.themeFile);
|
|
23
|
-
};
|
|
24
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var fs = require('fs');
|
|
2
|
-
var request = require('request');
|
|
3
|
-
var source = require('vinyl-source-stream');
|
|
4
|
-
|
|
5
|
-
// helper to allow us to define an "end" event to multiple streams
|
|
6
|
-
function streamToDestination(gulp, gulpPlugins, siteSettings) {
|
|
7
|
-
var finalDestination;
|
|
8
|
-
|
|
9
|
-
if (!fs.existsSync(siteSettings.distFolder)) {
|
|
10
|
-
finalDestination = siteSettings.srcFolder;
|
|
11
|
-
} else {
|
|
12
|
-
finalDestination = siteSettings.distFolder;
|
|
13
|
-
}
|
|
14
|
-
return new Promise(resolve => { // eslint-disable-line no-undef
|
|
15
|
-
const cachebuster = Math.round(new Date().getTime() / 1000);
|
|
16
|
-
request(`https://${siteSettings.nodeEnv}/quote/resources/data/tooltips.json?cb=${cachebuster}`)
|
|
17
|
-
.on('response', resp => {
|
|
18
|
-
if (resp.statusCode !== 200) {
|
|
19
|
-
throw new Error(`${resp.statusCode}: Error while fetching tooltips.json`);
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
.pipe(source('tooltips'))
|
|
23
|
-
.pipe(gulpPlugins.rename('tooltips.json'))
|
|
24
|
-
.pipe(gulp.dest(`${finalDestination}/${siteSettings.dataSubfolder}`))
|
|
25
|
-
.on('finish', resolve);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
module.exports = function(gulp, gulpPlugins, siteSettings) {
|
|
30
|
-
return function() {
|
|
31
|
-
return streamToDestination(gulp, gulpPlugins, siteSettings);
|
|
32
|
-
};
|
|
33
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/* global process */
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Details in SEO-11
|
|
5
|
-
*
|
|
6
|
-
* This is the same as js-lint with the folling modifications:
|
|
7
|
-
* - it does not produce eslint-results.xml file
|
|
8
|
-
* - it fails on any error or warning
|
|
9
|
-
*
|
|
10
|
-
* We only run it from Husky git hook.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
module.exports = function(gulp, gulpPlugins, siteSettings) {
|
|
14
|
-
// Default jsLint settings
|
|
15
|
-
if ('undefined' === typeof siteSettings.jsLint) {
|
|
16
|
-
siteSettings.jsLint = {
|
|
17
|
-
configFile: './node_modules/mod-build/.eslintrc.yml'
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return function() {
|
|
22
|
-
return gulp.src([
|
|
23
|
-
siteSettings.srcFolder + '/' + siteSettings.scriptsSubfolder + '/**/*.js',
|
|
24
|
-
'gulpfile.babel.js',
|
|
25
|
-
'gulp-tasks/*.js',
|
|
26
|
-
'!' + siteSettings.srcFolder + '/' + siteSettings.scriptsSubfolder + '/vendor/**/*.js' // do not lint 3rd party scripts
|
|
27
|
-
])
|
|
28
|
-
.pipe(gulpPlugins.eslint(siteSettings.jsLint))
|
|
29
|
-
.pipe(gulpPlugins.eslint.format())
|
|
30
|
-
.pipe(gulpPlugins.eslintThreshold.afterWarnings(1, function() {
|
|
31
|
-
return process.exit(2);
|
|
32
|
-
}))
|
|
33
|
-
.pipe(gulpPlugins.eslint.failAfterError());
|
|
34
|
-
};
|
|
35
|
-
};
|
package/gulp-tasks/js-lint.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module.exports = function(gulp, gulpPlugins, siteSettings) {
|
|
2
|
-
var fs = require('fs');
|
|
3
|
-
|
|
4
|
-
// Default jsLint settings
|
|
5
|
-
if ('undefined' === typeof siteSettings.jsLint) {
|
|
6
|
-
siteSettings.jsLint = {
|
|
7
|
-
configFile: './node_modules/mod-build/.eslintrc.yml'
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return function() {
|
|
12
|
-
return gulp.src([
|
|
13
|
-
siteSettings.srcFolder + '/' + siteSettings.scriptsSubfolder + '/**/*.js',
|
|
14
|
-
'gulpfile.babel.js',
|
|
15
|
-
'gulp-tasks/*.js',
|
|
16
|
-
'!' + siteSettings.srcFolder + '/' + siteSettings.scriptsSubfolder + '/vendor/**/*.js', // do not lint 3rd party scripts,
|
|
17
|
-
'!' + siteSettings.srcFolder + '/' + siteSettings.scriptsSubfolder + '/resources/**/*.js', // do not lint copied shared resource scripts,
|
|
18
|
-
'!' + siteSettings.srcFolder + '/' + siteSettings.scriptsCompiledFolder + '**/*.js' // do not lint compiled scripts
|
|
19
|
-
])
|
|
20
|
-
.pipe(gulpPlugins.eslint(siteSettings.jsLint))
|
|
21
|
-
.pipe(gulpPlugins.eslint.format())
|
|
22
|
-
.pipe(gulpPlugins.eslint.format('junit', fs.createWriteStream('eslint-results.xml')));
|
|
23
|
-
};
|
|
24
|
-
};
|
package/gulp-tasks/minify.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
const babelOpts = {
|
|
2
|
-
presets: ['@babel/preset-env']
|
|
3
|
-
};
|
|
4
|
-
const cleanCssOpts = {
|
|
5
|
-
compatibility: 'ie8'
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
module.exports.html = function(gulp, gulpPlugins, siteSettings) {
|
|
9
|
-
return function() {
|
|
10
|
-
return gulp.src(siteSettings.tmpFolder + '/**/*.html')
|
|
11
|
-
.pipe(gulpPlugins.useref({
|
|
12
|
-
searchPath: [siteSettings.tmpFolder, './']
|
|
13
|
-
}))
|
|
14
|
-
.pipe(gulpPlugins.if('*.js', gulpPlugins.babel(babelOpts)))
|
|
15
|
-
.pipe(gulpPlugins.if('*.js', gulpPlugins.uglify()))
|
|
16
|
-
.pipe(gulpPlugins.if('*.css', gulpPlugins.cleanCss(cleanCssOpts)))
|
|
17
|
-
.pipe(gulpPlugins.if('*.css', gulpPlugins.csso()))
|
|
18
|
-
.pipe(gulpPlugins.revReplace())
|
|
19
|
-
.pipe(gulpPlugins.if('*.html', gulpPlugins.htmlmin({
|
|
20
|
-
collapseWhitespace: true,
|
|
21
|
-
minifyJS: {
|
|
22
|
-
mangle: false
|
|
23
|
-
}
|
|
24
|
-
})))
|
|
25
|
-
.pipe(gulp.dest(siteSettings.distFolder));
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
module.exports.css = function(gulp, gulpPlugins, siteSettings) {
|
|
30
|
-
return function() {
|
|
31
|
-
return gulp.src([siteSettings.tmpFolder + '/**/*.css', siteSettings.srcFolder + '/**/*.css'])
|
|
32
|
-
.pipe(gulpPlugins.cleanCss(cleanCssOpts))
|
|
33
|
-
.pipe(gulpPlugins.csso())
|
|
34
|
-
.pipe(gulp.dest(siteSettings.distFolder));
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
module.exports.js = function(gulp, gulpPlugins, siteSettings) {
|
|
39
|
-
return function() {
|
|
40
|
-
return gulp.src([siteSettings.srcFolder + '/**/*.js', '!' + siteSettings.srcFolder + '/data/**/*.js'])
|
|
41
|
-
.pipe(gulpPlugins.babel(babelOpts))
|
|
42
|
-
.pipe(gulpPlugins.uglify())
|
|
43
|
-
.on('error', function(err) {
|
|
44
|
-
console.log(err);
|
|
45
|
-
this.end();
|
|
46
|
-
})
|
|
47
|
-
.pipe(gulp.dest(siteSettings.distFolder));
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
module.exports.img = function() {
|
|
52
|
-
return function() {
|
|
53
|
-
return true;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
function imgMinByType(imgType, gulp, gulpPlugins, siteSettings) {
|
|
58
|
-
var srcPaths = [];
|
|
59
|
-
|
|
60
|
-
if (imgType === 'jpg') {
|
|
61
|
-
var imageminMozjpeg = require('imagemin-mozjpeg'),
|
|
62
|
-
imgExtMask = '{jpg,jpeg}',
|
|
63
|
-
imgMinSettings = [
|
|
64
|
-
imageminMozjpeg({
|
|
65
|
-
quality: 80
|
|
66
|
-
})
|
|
67
|
-
];
|
|
68
|
-
} else if (imgType === 'png') {
|
|
69
|
-
var imgExtMask = 'png',
|
|
70
|
-
imgMinSettings = [
|
|
71
|
-
gulpPlugins.imagemin.optipng({
|
|
72
|
-
optimizationLevel: 5
|
|
73
|
-
})
|
|
74
|
-
];
|
|
75
|
-
} else if (imgType === 'gif') {
|
|
76
|
-
var imgExtMask = 'gif',
|
|
77
|
-
imgMinSettings = [
|
|
78
|
-
gulpPlugins.imagemin.gifsicle({
|
|
79
|
-
interlaced: true
|
|
80
|
-
})
|
|
81
|
-
];
|
|
82
|
-
} else if (imgType === 'svg') {
|
|
83
|
-
var imgExtMask = 'svg',
|
|
84
|
-
imgMinSettings = [
|
|
85
|
-
gulpPlugins.imagemin.svgo()
|
|
86
|
-
];
|
|
87
|
-
} else if (imgType === 'webp') {
|
|
88
|
-
var imageminWebp = require('imagemin-webp'),
|
|
89
|
-
imgExtMask = 'webp',
|
|
90
|
-
imgMinSettings = [
|
|
91
|
-
imageminWebp({
|
|
92
|
-
quality: 80
|
|
93
|
-
})
|
|
94
|
-
];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
for (var i = 0; i < siteSettings.browserSyncServeFolders.length; i ++) {
|
|
98
|
-
srcPaths.push(siteSettings.browserSyncServeFolders[i] + '/' + siteSettings.imagesSubfolder + '/**/*.' + imgExtMask);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return function() {
|
|
102
|
-
return gulp.src(srcPaths)
|
|
103
|
-
.pipe(gulpPlugins.imagemin(imgMinSettings))
|
|
104
|
-
.on('error', function(err) {
|
|
105
|
-
console.log(err);
|
|
106
|
-
this.end();
|
|
107
|
-
})
|
|
108
|
-
.pipe(gulp.dest(siteSettings.distFolder + '/' + siteSettings.imagesSubfolder));
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
module.exports.imgJpg = function(gulp, gulpPlugins, siteSettings) {
|
|
113
|
-
return imgMinByType('jpg', gulp, gulpPlugins, siteSettings);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
module.exports.imgPng = function(gulp, gulpPlugins, siteSettings) {
|
|
117
|
-
return imgMinByType('png', gulp, gulpPlugins, siteSettings);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
module.exports.imgGif = function(gulp, gulpPlugins, siteSettings) {
|
|
121
|
-
return imgMinByType('gif', gulp, gulpPlugins, siteSettings);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
module.exports.imgSvg = function(gulp, gulpPlugins, siteSettings) {
|
|
125
|
-
return imgMinByType('svg', gulp, gulpPlugins, siteSettings);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
module.exports.imgWebp = function(gulp, gulpPlugins, siteSettings) {
|
|
129
|
-
return imgMinByType('webp', gulp, gulpPlugins, siteSettings);
|
|
130
|
-
};
|
|
131
|
-
|
package/gulp-tasks/sass-lint.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module.exports = function(gulp, gulpPlugins, siteSettings) {
|
|
2
|
-
// Default sassLint settings
|
|
3
|
-
if ('undefined' === typeof siteSettings.sassLint) {
|
|
4
|
-
siteSettings.sassLint = {
|
|
5
|
-
configFile: './node_modules/mod-build/.sass-lint.yml'
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
return function() {
|
|
10
|
-
gulp.src(siteSettings.srcFolder + '/styles/**/*.scss')
|
|
11
|
-
.pipe(gulpPlugins.sassLint(siteSettings.sassLint))
|
|
12
|
-
.pipe(gulpPlugins.sassLint.format())
|
|
13
|
-
.pipe(gulpPlugins.sassLint.failOnError());
|
|
14
|
-
};
|
|
15
|
-
};
|