mod-build 4.0.102 → 4.0.103

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.
Files changed (110) hide show
  1. package/package.json +2 -2
  2. package/public/resources/scripts/abandonment/abandonment-a4bbb36fbc8ed64042b8.min.js +2 -0
  3. package/public/resources/scripts/abandonment/abandonment.min.js +2 -0
  4. package/public/resources/scripts/callrail/callrail-14011d73b50a928de4b4.min.js +2 -0
  5. package/public/resources/scripts/callrail/callrail.min.js +2 -0
  6. package/public/resources/scripts/footer/footer-component-46dc0d7ca6af4fc3b76b.min.js +2 -0
  7. package/public/resources/scripts/footer/footer-component.min.js +2 -0
  8. package/public/resources/scripts/geolocation/geolocation.min.js +2 -0
  9. package/public/resources/scripts/helpers/addVWOTestQueryParam.min.js +2 -0
  10. package/public/resources/scripts/helpers/addVWOTestQueryParam.min.js.map +1 -0
  11. package/public/resources/scripts/helpers/additionalOpts.min.js +2 -0
  12. package/public/resources/scripts/helpers/additionalOpts.min.js.map +1 -0
  13. package/public/resources/scripts/helpers/calls-only.min.js +2 -0
  14. package/public/resources/scripts/helpers/calls-only.min.js.map +1 -0
  15. package/public/resources/scripts/helpers/getPhoneAssignmentData.min.js +2 -0
  16. package/public/resources/scripts/helpers/getPhoneAssignmentData.min.js.map +1 -0
  17. package/public/resources/scripts/helpers/initNumericOnlyFields.min.js +2 -0
  18. package/public/resources/scripts/helpers/initNumericOnlyFields.min.js.map +1 -0
  19. package/public/resources/scripts/helpers/initQSForm.min.js +2 -0
  20. package/public/resources/scripts/helpers/initQSForm.min.js.map +1 -0
  21. package/public/resources/scripts/helpers/initQuadTransform.min.js +2 -0
  22. package/public/resources/scripts/helpers/initQuadTransform.min.js.map +1 -0
  23. package/public/resources/scripts/helpers/isZipCodeValid.min.js +2 -0
  24. package/public/resources/scripts/helpers/isZipCodeValid.min.js.map +1 -0
  25. package/public/resources/scripts/helpers/observeVWOVariation.min.js +2 -0
  26. package/public/resources/scripts/helpers/observeVWOVariation.min.js.map +1 -0
  27. package/public/resources/scripts/helpers/opts.min.js +2 -0
  28. package/public/resources/scripts/helpers/opts.min.js.map +1 -0
  29. package/public/resources/scripts/jornaya.hbs +35 -0
  30. package/public/resources/scripts/jornaya.html +35 -0
  31. package/public/resources/scripts/mod-alytics/modalytics-be44027508c0438f6709.min.js +2 -0
  32. package/public/resources/scripts/mod-alytics/modalytics.min.js +2 -0
  33. package/public/resources/scripts/mod-form/form/contractor-0918337caf3dfede1609.min.js +2 -0
  34. package/public/resources/scripts/mod-form/form/contractor.min.js +2 -0
  35. package/public/resources/scripts/mod-form/form/homeowner-19a121b0e596042326f4.min.js +2 -0
  36. package/public/resources/scripts/mod-form/form/homeowner.min.js +2 -0
  37. package/public/resources/scripts/mod-utils/modutils-bc275eb41af515f626ef.min.js +2 -0
  38. package/public/resources/scripts/mod-utils/modutils.min.js +2 -0
  39. package/public/resources/scripts/trusted-form.hbs +38 -0
  40. package/public/resources/scripts/trusted-form.html +38 -0
  41. package/public/resources/styles/components/abandonment/abandonment-8a673f060817db6cb7dc.min.css +1 -0
  42. package/public/resources/styles/components/abandonment/abandonment.min.css +1 -0
  43. package/public/resources/styles/components/footer/mod-footer-d233fa64b6c8297c70ec.min.css +1 -0
  44. package/public/resources/styles/components/footer/mod-footer.min.css +1 -0
  45. package/public/resources/styles/components/footer/qs-footer-926e67c28d10c729db46.min.css +1 -0
  46. package/public/resources/styles/components/footer/qs-footer.min.css +1 -0
  47. package/src/resources/templates/modals/privacy/index.hbs +88 -89
  48. package/src/resources/templates/modals/privacy/index.html +88 -89
  49. package/src/resources/templates/modals/terms/index.hbs +8 -7
  50. package/src/resources/templates/modals/terms/index.html +8 -7
  51. package/src/scripts/globals.js +1 -3
  52. package/src/scripts/plugins.js +0 -3
  53. package/tasks/templates.js +2 -4
  54. package/gulp-tasks/add-path-subdirectories.js +0 -34
  55. package/gulp-tasks/build-stat.js +0 -9
  56. package/gulp-tasks/build.js +0 -28
  57. package/gulp-tasks/cache-bust.js +0 -19
  58. package/gulp-tasks/check-seasonal-variations.js +0 -21
  59. package/gulp-tasks/clean.js +0 -10
  60. package/gulp-tasks/combine-files.js +0 -7
  61. package/gulp-tasks/compile.js +0 -44
  62. package/gulp-tasks/copy-files-to-build-path.js +0 -8
  63. package/gulp-tasks/copy-fonts.js +0 -6
  64. package/gulp-tasks/copy-json.js +0 -6
  65. package/gulp-tasks/copy-resources-to-dist.js +0 -6
  66. package/gulp-tasks/copy-videos.js +0 -6
  67. package/gulp-tasks/extras.js +0 -22
  68. package/gulp-tasks/grab-cdn.js +0 -74
  69. package/gulp-tasks/grab-form-helpers.js +0 -55
  70. package/gulp-tasks/grab-global-images.js +0 -121
  71. package/gulp-tasks/grab-images.js +0 -79
  72. package/gulp-tasks/grab-shared-components.js +0 -46
  73. package/gulp-tasks/grab-shared-scripts.js +0 -275
  74. package/gulp-tasks/grab-theme-json.js +0 -24
  75. package/gulp-tasks/grab-tooltips-json.js +0 -33
  76. package/gulp-tasks/js-lint-husky.js +0 -35
  77. package/gulp-tasks/js-lint.js +0 -24
  78. package/gulp-tasks/minify.js +0 -131
  79. package/gulp-tasks/sass-lint.js +0 -15
  80. package/gulp-tasks/serve.js +0 -74
  81. package/gulp-tasks/settings.js +0 -22
  82. package/gulp-tasks/styles.js +0 -42
  83. package/gulp-tasks/tasks.js +0 -475
  84. package/gulp-tasks/templates.js +0 -288
  85. package/src/data/footer.js +0 -119
  86. package/src/scripts/default/additional-assets.js +0 -60
  87. package/src/scripts/default/rage-clicking.js +0 -54
  88. package/src/scripts/default/show-utility-providers.js +0 -28
  89. package/src/scripts/url-cleaner.js +0 -8
  90. package/src/scripts/vendor/google-tag-manager-head.js +0 -6
  91. package/src/scripts/vendor/heap-addeventproperties-identify.js +0 -262
  92. package/src/scripts/vendor/heap-tracking.js +0 -9
  93. package/src/styles/partials/_contact-us.scss +0 -196
  94. package/src/styles/partials/_google-address-autocomplete.scss +0 -52
  95. package/src/styles/partials/_mixins.scss +0 -39
  96. package/src/styles/partials/_modal-pages.scss +0 -125
  97. package/src/styles/partials/_modernize-colors.scss +0 -128
  98. package/src/styles/partials/_qs-footer.scss +0 -68
  99. package/src/styles/partials/_quote-footer-v1.scss +0 -79
  100. package/src/styles/partials/_quote-footer-v2.scss +0 -64
  101. package/src/styles/partials/_quote-footer-v3.scss +0 -65
  102. package/src/templates/_partials/scripts/deferred-styles.html +0 -16
  103. package/src/templates/_partials/scripts/heap-bundle.html +0 -5
  104. package/src/templates/_partials/scripts/heap.html +0 -4
  105. package/src/templates/_partials/scripts/utm-params.html +0 -9
  106. package/src/templates/components/qs-footer.html +0 -55
  107. package/src/templates/components/quote-footer-v1.html +0 -148
  108. package/src/templates/components/quote-footer-v2.html +0 -169
  109. /package/tasks/{addSeasonalchanges.js → add-seasonal-changes.js} +0 -0
  110. /package/tasks/{setupDevOpsTrackingId.js → setup-dev-ops-tracking-id.js} +0 -0
@@ -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
- };
@@ -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
- };
@@ -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
-
@@ -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
- };
@@ -1,74 +0,0 @@
1
- // Serve site from src folder
2
- module.exports.src = function(gulp, gulpPlugins, siteSettings, siteData) {
3
- return function() {
4
- var runSequence = require('run-sequence');
5
- var sequenceOpts;
6
- if (siteData.useTypescript) {
7
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'compile', 'grab-tooltips-json', 'combine-files', 'grab-images', 'js-lint'];
8
- } else if (siteData.isQSPage) {
9
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'grab-theme-json', 'grab-tooltips-json', 'combine-files', 'grab-images', 'js-lint'];
10
- } else {
11
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'grab-tooltips-json', 'combine-files', 'grab-images','grab-global-images', 'js-lint'];
12
- }
13
- runSequence(...sequenceOpts, () => {
14
- // Run a BrowserSync server
15
- gulpPlugins.browserSync({
16
- notify: false,
17
- port: 9000,
18
- server: {
19
- baseDir: siteSettings.browserSyncServeFolders,
20
- routes: {
21
- '/node_modules': 'node_modules'
22
- },
23
- middleware: function(req, res, next) {
24
- res.setHeader('Access-Control-Allow-Origin', '*');
25
- next();
26
- }
27
- }
28
- });
29
-
30
- // If any assets have changed, reload the page
31
- gulp.watch([
32
- siteSettings.tmpFolder + '/**/*.html',
33
- siteSettings.tmpFolder + '/' + siteSettings.fontsSubfolder + '/**/*',
34
- siteSettings.srcFolder + '/' + siteSettings.scriptsSubfolder + '/**/*.js',
35
- siteSettings.srcFolder + '/' + siteSettings.imagesSubfolder + '/**/*'
36
- ]).on('change', gulpPlugins.browserSync.reload);
37
-
38
- // If templates changed, rerun templates task
39
- if (!siteData.useTypescript && !siteData.isQSPage) {
40
- gulp.watch(siteSettings.srcFolder + '/' + siteSettings.templatesSubfolder + '/**/*.html', function() {
41
- runSequence('templates','grab-global-images')
42
- });
43
- } else {
44
- gulp.watch(siteSettings.srcFolder + '/' + siteSettings.templatesSubfolder + '/**/*.html', ['templates'])
45
- }
46
-
47
- // If styles changed, rerun styles task
48
- gulp.watch(siteSettings.srcFolder + '/' + siteSettings.stylesSubfolder + '/**/*.scss', ['styles']);
49
-
50
- // If scripts changed, rerun js-lint task
51
- gulp.watch([
52
- siteSettings.srcFolder + '/' + siteSettings.scriptsSubfolder + '/**/*.js',
53
- siteSettings.srcFolder + '/' + siteSettings.scriptsSubfolder + '/**/*.ts',
54
- '!' + siteSettings.srcFolder + '/' + siteSettings.scriptsCompiledFolder + '**/*.js', // dont reload on compilation pipe
55
- 'gulpfile.babel.js',
56
- 'gulp-tasks/*.js'
57
- ], ['compile', 'js-lint']);
58
- });
59
- };
60
- };
61
-
62
- // Serve site from dist folder
63
- module.exports.dist = function(gulp, gulpPlugins, siteSettings) {
64
- return function() {
65
- // Run a BrowserSync server
66
- gulpPlugins.browserSync({
67
- notify: false,
68
- port: 9000,
69
- server: {
70
- baseDir: [siteSettings.distFolder]
71
- }
72
- });
73
- };
74
- };
@@ -1,22 +0,0 @@
1
- /**
2
- * Settings for Gulp tasks (e.g. folder structure)
3
- * @returns {Object} - folders
4
- */
5
- module.exports = function() {
6
- return {
7
- tmpFolder: '.tmp',
8
- srcFolder: 'src',
9
- browserSyncServeFolders: ['.tmp', 'src', 'node_modules/mod-style-bootstrap/src', 'node_modules/mod-base/src'],
10
- distFolder: 'dist',
11
- fontsSubfolder: 'fonts',
12
- imagesSubfolder: 'images',
13
- stylesSubfolder: 'styles',
14
- scriptsSubfolder: 'scripts',
15
- scriptsCompiledFolder: 'scripts/compiled',
16
- templatesSubfolder: 'templates',
17
- dataSubfolder: 'data',
18
- nodeEnv: process.env.NODE_ENV, // eslint-disable-line no-undef
19
- isLocal: process.env.IS_LOCAL, // eslint-disable-line no-undef
20
- buildPath: process.env.BUILD_PATH // eslint-disable-line no-undef
21
- };
22
- };