mod-build 4.0.0 → 4.0.1-beta.2

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 (165) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/package.json +1 -1
  3. package/src/scripts/default/index.js +9 -0
  4. package/src/scripts/default/update-link-paths.js +7 -13
  5. package/src/scripts/default/use-dynamic-gtm.js +4 -5
  6. package/src/scripts/plugins.js +109 -0
  7. package/src/scripts/utils.js +12 -52
  8. package/tasks/serve.js +1 -1
  9. package/vite.config.js +3 -51
  10. package/src/accessible-components/button/_button.scss +0 -308
  11. package/src/accessible-components/button/back-button.html +0 -8
  12. package/src/accessible-components/button/button.html +0 -17
  13. package/src/accessible-components/carousel/_carousel.scss +0 -112
  14. package/src/accessible-components/carousel/carousel.html +0 -25
  15. package/src/accessible-components/carousel/carousel.js +0 -3426
  16. package/src/accessible-components/carousel/carousel.js.map +0 -1
  17. package/src/accessible-components/carousel/carousel.min.js +0 -6
  18. package/src/accessible-components/carousel/carousel.min.js.map +0 -1
  19. package/src/accessible-components/checkbox/_checkbox.scss +0 -153
  20. package/src/accessible-components/checkbox/checkbox-group.html +0 -18
  21. package/src/accessible-components/checkbox/checkbox.html +0 -8
  22. package/src/accessible-components/expand-collapse/_expand-collapse.scss +0 -129
  23. package/src/accessible-components/expand-collapse/expand-collapse.html +0 -14
  24. package/src/accessible-components/expand-collapse/expand-collapse.js +0 -52
  25. package/src/accessible-components/expand-collapse/expand-collapse.min.js +0 -2
  26. package/src/accessible-components/expand-collapse/expand-collapse.min.js.map +0 -1
  27. package/src/accessible-components/featured-block/_featured-block.scss +0 -221
  28. package/src/accessible-components/featured-block/featured-block.html +0 -54
  29. package/src/accessible-components/foot-assets/foot-assets.html +0 -112
  30. package/src/accessible-components/footer/footer.html +0 -2
  31. package/src/accessible-components/gtm-body/gtm-body.html +0 -4
  32. package/src/accessible-components/head/head.html +0 -187
  33. package/src/accessible-components/header/_header.scss +0 -287
  34. package/src/accessible-components/header/header.html +0 -66
  35. package/src/accessible-components/hero/_hero.scss +0 -405
  36. package/src/accessible-components/hero/hero.html +0 -53
  37. package/src/accessible-components/how-it-works/_how-it-works.scss +0 -217
  38. package/src/accessible-components/how-it-works/how-it-works-carousel.html +0 -12
  39. package/src/accessible-components/how-it-works/how-it-works-static.html +0 -12
  40. package/src/accessible-components/how-it-works/how-it-works.html +0 -14
  41. package/src/accessible-components/information/_information.scss +0 -96
  42. package/src/accessible-components/information/information.html +0 -32
  43. package/src/accessible-components/input/_input.scss +0 -204
  44. package/src/accessible-components/input/input.html +0 -22
  45. package/src/accessible-components/input/textarea.html +0 -9
  46. package/src/accessible-components/partners/_partners.scss +0 -234
  47. package/src/accessible-components/partners/partners.html +0 -56
  48. package/src/accessible-components/picture/picture.html +0 -19
  49. package/src/accessible-components/preloader/_preloader.scss +0 -61
  50. package/src/accessible-components/preloader/preloader.html +0 -23
  51. package/src/accessible-components/progress-bar/_progress-bar.scss +0 -140
  52. package/src/accessible-components/progress-bar/progress-bar.html +0 -21
  53. package/src/accessible-components/progress-bar/progress-bar.js +0 -37
  54. package/src/accessible-components/progress-bar/progress-bar.min.js +0 -2
  55. package/src/accessible-components/progress-bar/progress-bar.min.js.map +0 -1
  56. package/src/accessible-components/radio-button/_radio-button.scss +0 -586
  57. package/src/accessible-components/radio-button/radio-button.html +0 -33
  58. package/src/accessible-components/reviews/_reviews.scss +0 -175
  59. package/src/accessible-components/reviews/reviews-carousel.html +0 -12
  60. package/src/accessible-components/reviews/reviews-static.html +0 -12
  61. package/src/accessible-components/reviews/reviews.html +0 -37
  62. package/src/accessible-components/select/_select.scss +0 -69
  63. package/src/accessible-components/select/select.html +0 -10
  64. package/src/accessible-components/steps/_steps.scss +0 -636
  65. package/src/accessible-components/steps/defaultFormFieldConfig.json +0 -109
  66. package/src/accessible-components/steps/step-fields.html +0 -38
  67. package/src/accessible-components/steps/steps.html +0 -160
  68. package/src/accessible-components/tcpa/_tcpa.scss +0 -49
  69. package/src/accessible-components/tcpa/tcpa.html +0 -9
  70. package/src/accessible-components/tile/_tile.scss +0 -117
  71. package/src/accessible-components/tile/tile.html +0 -14
  72. package/src/accessible-components/value-props/_value-props.scss +0 -102
  73. package/src/accessible-components/value-props/value-props.html +0 -17
  74. package/src/accessible-components/zip-control/_zip-control.scss +0 -79
  75. package/src/accessible-components/zip-control/zip-control.html +0 -10
  76. package/src/resources/data/tcpa.json +0 -3
  77. package/src/resources/scripts/abandonment/abandonment-e099a424bf17408f1db2.min.js +0 -2
  78. package/src/resources/scripts/abandonment/abandonment.min.js +0 -2
  79. package/src/resources/scripts/footer/footer-component-7b5e263f64568573ecc0.min.js +0 -2
  80. package/src/resources/scripts/footer/footer-component.min.js +0 -2
  81. package/src/resources/scripts/helpers/initNumericOnlyFields.min.js +0 -2
  82. package/src/resources/scripts/helpers/initNumericOnlyFields.min.js.map +0 -1
  83. package/src/resources/scripts/helpers/isZipCodeValid.min.js +0 -2
  84. package/src/resources/scripts/helpers/isZipCodeValid.min.js.map +0 -1
  85. package/src/resources/scripts/mod-alytics/modalytics-0ac7d7a5a72ea67a0f47.min.js +0 -2
  86. package/src/resources/scripts/mod-alytics/modalytics.min.js +0 -2
  87. package/src/resources/scripts/mod-form/form/homeowner-f395431201f7a6e56690.min.js +0 -2
  88. package/src/resources/scripts/mod-form/form/homeowner.min.js +0 -2
  89. package/src/resources/scripts/mod-utils/modutils-a08fecfbb83afad1a9f8.min.js +0 -2
  90. package/src/resources/scripts/mod-utils/modutils.min.js +0 -2
  91. package/src/resources/styles/components/abandonment/abandonment-a8571a9e32ed6ef9acb4.min.css +0 -1
  92. package/src/resources/styles/components/abandonment/abandonment.min.css +0 -1
  93. package/src/resources/styles/components/footer/mod-footer-1fb2cec3278f29df57d0.min.css +0 -1
  94. package/src/resources/styles/components/footer/mod-footer.min.css +0 -1
  95. package/src/resources/styles/components/footer/qs-footer-9a3b0ab00428b03e6e9e.min.css +0 -1
  96. package/src/resources/styles/components/footer/qs-footer.min.css +0 -1
  97. package/src/resources/templates/modals/about/index.hbs +0 -9
  98. package/src/resources/templates/modals/about/index.html +0 -9
  99. package/src/resources/templates/modals/contact-us/index.hbs +0 -348
  100. package/src/resources/templates/modals/contact-us/index.html +0 -348
  101. package/src/resources/templates/modals/faq/index.hbs +0 -9
  102. package/src/resources/templates/modals/faq/index.html +0 -9
  103. package/src/resources/templates/modals/privacy/index.hbs +0 -236
  104. package/src/resources/templates/modals/privacy/index.html +0 -236
  105. package/src/resources/templates/modals/terms/index.hbs +0 -166
  106. package/src/resources/templates/modals/terms/index.html +0 -166
  107. package/src/shared-components/card-button/_card-button.scss +0 -49
  108. package/src/shared-components/card-button/card-button.html +0 -9
  109. package/src/shared-components/carousel/_carousel.scss +0 -106
  110. package/src/shared-components/carousel/carousel.html +0 -22
  111. package/src/shared-components/carousel/carousel.js +0 -3427
  112. package/src/shared-components/carousel/carousel.js.map +0 -1
  113. package/src/shared-components/carousel/carousel.min.js +0 -6
  114. package/src/shared-components/carousel/carousel.min.js.map +0 -1
  115. package/src/shared-components/carousel/carousel.min.min.js +0 -6
  116. package/src/shared-components/carousel/carousel.min.min.js.map +0 -1
  117. package/src/shared-components/checkbox/_checkbox.scss +0 -104
  118. package/src/shared-components/checkbox/checkbox.html +0 -6
  119. package/src/shared-components/expand-collapse/_expand-collapse.scss +0 -93
  120. package/src/shared-components/expand-collapse/expand-collapse.html +0 -8
  121. package/src/shared-components/expand-collapse/expand-collapse.js +0 -40
  122. package/src/shared-components/expand-collapse/expand-collapse.min.js +0 -2
  123. package/src/shared-components/expand-collapse/expand-collapse.min.js.map +0 -1
  124. package/src/shared-components/featured-block/_featured-block.scss +0 -185
  125. package/src/shared-components/featured-block/featured-block.html +0 -62
  126. package/src/shared-components/foot-assets/foot-assets.html +0 -107
  127. package/src/shared-components/form-tcpa/form-tcpa.html +0 -12
  128. package/src/shared-components/gtm-body/gtm-body.html +0 -4
  129. package/src/shared-components/head/head.html +0 -192
  130. package/src/shared-components/header/_header.scss +0 -200
  131. package/src/shared-components/header/header.html +0 -71
  132. package/src/shared-components/hero/_hero.scss +0 -253
  133. package/src/shared-components/hero/hero.html +0 -126
  134. package/src/shared-components/how-it-works/_how-it-works.scss +0 -138
  135. package/src/shared-components/how-it-works/how-it-works.html +0 -19
  136. package/src/shared-components/input/_input.scss +0 -229
  137. package/src/shared-components/input/input.html +0 -30
  138. package/src/shared-components/preloader/_preloader.scss +0 -61
  139. package/src/shared-components/preloader/preloader.html +0 -49
  140. package/src/shared-components/progress-bar/_progress-bar.scss +0 -105
  141. package/src/shared-components/progress-bar/progress-bar.html +0 -20
  142. package/src/shared-components/progress-bar/progress-bar.js +0 -25
  143. package/src/shared-components/progress-bar/progress-bar.min.js +0 -2
  144. package/src/shared-components/progress-bar/progress-bar.min.js.map +0 -1
  145. package/src/shared-components/radio-button/_radio-button.scss +0 -554
  146. package/src/shared-components/radio-button/radio-button.html +0 -25
  147. package/src/shared-components/reviews/_reviews.scss +0 -79
  148. package/src/shared-components/reviews/reviews.html +0 -27
  149. package/src/shared-components/select/_select.scss +0 -61
  150. package/src/shared-components/select/select.html +0 -8
  151. package/src/shared-components/steps/_steps.scss +0 -334
  152. package/src/shared-components/steps/defaultFormFieldConfig.json +0 -64
  153. package/src/shared-components/steps/step-fields.html +0 -36
  154. package/src/shared-components/steps/steps.html +0 -131
  155. package/src/shared-components/textarea/_textarea.scss +0 -96
  156. package/src/shared-components/textarea/textarea.html +0 -13
  157. package/src/shared-components/theme-toggle/_theme-toggle.scss +0 -68
  158. package/src/shared-components/theme-toggle/theme-toggle.html +0 -34
  159. package/src/shared-components/tile/_tile.scss +0 -117
  160. package/src/shared-components/tile/tile.html +0 -27
  161. package/src/shared-components/value-props/_value-props.scss +0 -98
  162. package/src/shared-components/value-props/value-props.html +0 -17
  163. package/src/shared-components/zip-control/_zip-control.scss +0 -42
  164. package/src/shared-components/zip-control/zip-control.html +0 -21
  165. package/src/temp/scripts/maxmind-geoip2.js +0 -104
package/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 4.0.1
2
+
3
+ - Clean up some plugins into separate files
4
+ - Add footAssetsConfig to additionalAssets
5
+
1
6
  ## 4.0.0-beta.5
2
7
 
3
8
  - Updated the `transformIndexHtml` hook to use the `writeBundle` hook in the ViteConfig.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "4.0.0",
3
+ "version": "4.0.1-beta.2",
4
4
  "description": "Share components for S3 sites.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -0,0 +1,9 @@
1
+ import { loadAdditionalAssets } from "./additional-assets.js";
2
+ import { useDynamicGtm } from './use-dynamic-gtm.js';
3
+ import { updateFooterLinkPaths } from "./update-link-paths.js";
4
+
5
+ export const globals = (config) => {
6
+ useDynamicGtm(config);
7
+ loadAdditionalAssets(config);
8
+ updateFooterLinkPaths();
9
+ }
@@ -1,3 +1,5 @@
1
+ import { observeMutations } from "../utils.js";
2
+
1
3
  const updateFooterModalPaths = () => {
2
4
  const footerModalLinks = document.querySelectorAll('.footer__links a');
3
5
  footerModalLinks.forEach((link) => {
@@ -13,19 +15,11 @@ const updateFooterModalPaths = () => {
13
15
  });
14
16
  };
15
17
 
16
- export const waitForFooterLinks = () => {
17
- const observer = new MutationObserver((mutationsList) => {
18
- for (const mutation of mutationsList) {
19
- if (mutation.type === 'childList') {
20
- const footerLinks = document.querySelector('.footer__links');
21
- if (footerLinks) {
22
- observer.disconnect();
23
- updateFooterModalPaths();
24
- break;
25
- }
26
- }
18
+ export const updateFooterLinkPaths = () => {
19
+ observeMutations(document.body, () => {
20
+ const updatedFooterLinks = document.querySelector('.footer__links');
21
+ if (updatedFooterLinks) {
22
+ updateFooterModalPaths();
27
23
  }
28
24
  });
29
-
30
- observer.observe(document.body, { childList: true, subtree: true });
31
25
  };
@@ -1,11 +1,10 @@
1
1
 
2
2
  export const useDynamicGtm = (config) => {
3
3
  const { page } = config;
4
-
5
4
  if (page.headConfig.useDynamicGtm || typeof window.isQSPage === 'undefined') {
6
- import('@/scripts/has-qs-params.js').then((qs) => {
7
- qs.default();
8
- window.gtm_container_ID = window.isQSPage ? config.qs_gtm_container_ID : config.gtm_container_ID;
9
- });
5
+ import('@/scripts/has-qs-params.js').then((qs) => {
6
+ qs.default();
7
+ window.gtm_container_ID = window.isQSPage ? config.qs_gtm_container_ID : config.gtm_container_ID;
8
+ });
10
9
  }
11
10
  }
@@ -0,0 +1,109 @@
1
+ import fs from "node:fs";
2
+ import { defaultSettings } from "../data/config.js";
3
+ import footer from '../data/footer.js';
4
+ import { handlebarsHelpers } from "./utils.js";
5
+ import gulpHandlebarsFileInclude from "gulp-handlebars-file-include";
6
+ import merge from "lodash.merge";
7
+ import { glob } from 'glob'
8
+
9
+ export const STATIC_COPY_TARGETS = [
10
+ {
11
+ src: './src/resources/templates',
12
+ dest: './resources/'
13
+ },
14
+ {
15
+ src: './src/fonts',
16
+ dest: './'
17
+ },
18
+ {
19
+ src: './src/videos',
20
+ dest: './'
21
+ },
22
+ {
23
+ src: './src/accessible-components/carousel/carousel.min.js',
24
+ dest: './accessible-components/carousel'
25
+ },
26
+ {
27
+ src: './src/accessible-components/expand-collapse/expand-collapse.min.js',
28
+ dest: './accessible-components/expand-collapse'
29
+ },
30
+ {
31
+ src: './src/accessible-components/progress-bar/progress-bar.min.js',
32
+ dest: './accessible-components/progress-bar'
33
+ },
34
+ ];
35
+
36
+ export const updateConfig = async (config) => {
37
+ const { isLocal, nodeEnv, buildPath } = defaultSettings;
38
+ // eslint-disable-next-line no-unused-vars
39
+ let tempConfigExists;
40
+
41
+ let mergedConfig = {
42
+ ...config,
43
+ ...footer(config),
44
+ ...{ isLocal, nodeEnv, buildPath }
45
+ };
46
+
47
+ const checkForTempConfig = () => {
48
+ return new Promise((resolve) => {
49
+ tempConfigExists = fs.existsSync(`src/.tmp/config.json`);
50
+
51
+ const configData = fs.readFileSync('src/.tmp/config.json', 'utf8');
52
+ const parsedConfig = JSON.parse(configData);
53
+ mergedConfig = merge(parsedConfig, mergedConfig);
54
+
55
+ resolve();
56
+ });
57
+ };
58
+
59
+ return {
60
+ name: 'update-config',
61
+ async configResolved({ configFileDependencies }) {
62
+ await checkForTempConfig();
63
+
64
+ configFileDependencies.forEach((file) => {
65
+ if (file.endsWith('siteconfig.js') || file.endsWith('template.js')) {
66
+ console.log('siteconfig or template changed');
67
+ try {
68
+ // overwrite the config file with new data
69
+ fs.writeFileSync('src/.tmp/config.json', JSON.stringify(mergedConfig, null, 2));
70
+ } catch (error) {
71
+ console.error(`Error reading config file: ${error}`);
72
+ }
73
+ }
74
+ });
75
+ },
76
+ configureServer() {
77
+ gulpHandlebarsFileInclude(mergedConfig, { handlebarsHelpers, maxRecursion: 500 });
78
+ },
79
+ buildStart() {
80
+ gulpHandlebarsFileInclude(mergedConfig, { handlebarsHelpers, maxRecursion: 500 });
81
+ fs.writeFileSync('src/.tmp/config.json', JSON.stringify(mergedConfig, null, 2));
82
+ }
83
+ }
84
+ }
85
+
86
+ export const replaceSrcPaths = (config) => {
87
+ return {
88
+ name: 'replace-src-paths',
89
+ writeBundle: async () => {
90
+ const files = glob.sync(defaultSettings.distFolder + '/**/index.html');
91
+ for (const file of files) {
92
+ let html = await fs.promises.readFile(file, 'utf-8');
93
+ let updatedHtml = '';
94
+
95
+ if (config.pathSubdirectory && config.pathSubdirectory.length > 0) {
96
+ updatedHtml = html
97
+ .replace(/(src|data-load)="\/?src\//g, `$1="${config.pathSubdirectory}`)
98
+ .replace(/(src|srcset|data-load|href)="\/?assets\//g, `$1="${config.pathSubdirectory}assets/`)
99
+ .replace(/(src|data-load|href)="\/?resources\//g, `$1="${config.pathSubdirectory}resources/`)
100
+ } else {
101
+ updatedHtml = html.replace(/(src|data-load)="\/?src\//g, '$1="/');
102
+ }
103
+
104
+ await fs.promises.writeFile(file, updatedHtml);
105
+ }
106
+ },
107
+ apply: 'build',
108
+ }
109
+ }
@@ -1,9 +1,5 @@
1
- import fs from "node:fs";
2
1
  import { seasons } from "../data/seasons.js";
3
- import { defaultSettings } from "../data/config.js";
4
- import footer from '../data/footer.js';
5
2
  import gulpHandlebarsFileInclude from "gulp-handlebars-file-include";
6
- import merge from "lodash.merge";
7
3
 
8
4
  export function getFileFromURL(url) {
9
5
  return url.split('/').pop();
@@ -171,52 +167,16 @@ export const handlebarsHelpers = [
171
167
  }
172
168
  ]
173
169
 
174
- export const updateConfig = async (config) => {
175
- const { isLocal, nodeEnv, buildPath } = defaultSettings;
176
- // eslint-disable-next-line no-unused-vars
177
- let tempConfigExists;
178
-
179
- let mergedConfig = {
180
- ...config,
181
- ...footer(config),
182
- ...{ isLocal, nodeEnv, buildPath }
183
- };
184
-
185
- const checkForTempConfig = () => {
186
- return new Promise((resolve) => {
187
- tempConfigExists = fs.existsSync(`src/.tmp/config.json`);
188
-
189
- const configData = fs.readFileSync('src/.tmp/config.json', 'utf8');
190
- const parsedConfig = JSON.parse(configData);
191
- mergedConfig = merge(parsedConfig, mergedConfig);
192
-
193
- resolve();
194
- });
195
- };
196
-
197
- return {
198
- name: 'update-config',
199
- async configResolved({ configFileDependencies }) {
200
- await checkForTempConfig();
201
-
202
- configFileDependencies.forEach((file) => {
203
- if (file.endsWith('siteconfig.js') || file.endsWith('template.js')) {
204
- console.log('siteconfig or template changed');
205
- try {
206
- // overwrite the config file with new data
207
- fs.writeFileSync('src/.tmp/config.json', JSON.stringify(mergedConfig, null, 2));
208
- } catch (error) {
209
- console.error(`Error reading config file: ${error}`);
210
- }
211
- }
212
- });
213
- },
214
- configureServer() {
215
- gulpHandlebarsFileInclude(mergedConfig, { handlebarsHelpers, maxRecursion: 500 });
216
- },
217
- buildStart() {
218
- gulpHandlebarsFileInclude(mergedConfig, { handlebarsHelpers, maxRecursion: 500 });
219
- fs.writeFileSync('src/.tmp/config.json', JSON.stringify(mergedConfig, null, 2));
170
+ export const observeMutations = (target, callback) => {
171
+ const observer = new MutationObserver((mutationsList) => {
172
+ for (const mutation of mutationsList) {
173
+ if (mutation.type === 'childList') {
174
+ callback();
175
+ observer.disconnect();
176
+ break;
177
+ }
220
178
  }
221
- }
222
- }
179
+ });
180
+
181
+ observer.observe(target, { childList: true, subtree: true });
182
+ };
package/tasks/serve.js CHANGED
@@ -3,7 +3,7 @@ import grabSharedScripts from './grab-shared-scripts.js';
3
3
  import grabCdn from './grab-cdn.js';
4
4
  import grabFormHelpers from './grab-form-helpers.js';
5
5
  import templates from './templates.js';
6
- import { updateConfig } from '../src/scripts/utils.js';
6
+ import { updateConfig } from '../src/scripts/plugins.js';
7
7
 
8
8
  export async function startModBuild(config) {
9
9
  await grabCdn(config);
package/vite.config.js CHANGED
@@ -4,10 +4,8 @@ import eslint from 'vite-plugin-eslint'
4
4
  import { defaultSettings } from './src/data/config.js'
5
5
  import { defineConfig } from 'vite'
6
6
  import { startModBuild } from './tasks/serve.js'
7
- import { updateConfig } from './src/scripts/utils.js'
7
+ import { updateConfig, replaceSrcPaths, STATIC_COPY_TARGETS } from './src/scripts/plugins.js'
8
8
  import { viteStaticCopy } from 'vite-plugin-static-copy'
9
- import { glob } from 'glob'
10
- import fs from "node:fs";
11
9
 
12
10
  export default defineConfig((config) => ({
13
11
  build: {
@@ -27,32 +25,7 @@ export default defineConfig((config) => ({
27
25
  }),
28
26
  updateConfig(config),
29
27
  viteStaticCopy({
30
- targets: [
31
- {
32
- src: './src/resources/templates',
33
- dest: './resources/'
34
- },
35
- {
36
- src: './src/fonts',
37
- dest: './'
38
- },
39
- {
40
- src: './src/videos',
41
- dest: './'
42
- },
43
- {
44
- src: './src/accessible-components/carousel/carousel.min.js',
45
- dest: './accessible-components/carousel'
46
- },
47
- {
48
- src: './src/accessible-components/expand-collapse/expand-collapse.min.js',
49
- dest: './accessible-components/expand-collapse'
50
- },
51
- {
52
- src: './src/accessible-components/progress-bar/progress-bar.min.js',
53
- dest: './accessible-components/progress-bar'
54
- },
55
- ],
28
+ targets: STATIC_COPY_TARGETS,
56
29
  }),
57
30
  {
58
31
  ...eslint(),
@@ -66,28 +39,7 @@ export default defineConfig((config) => ({
66
39
  apply: 'serve',
67
40
  enforce: 'post'
68
41
  },
69
- {
70
- name: 'replace-src-paths',
71
- writeBundle: async () => {
72
- const files = glob.sync(defaultSettings.distFolder + '/**/index.html');
73
- for (const file of files) {
74
- let html = await fs.promises.readFile(file, 'utf-8');
75
- let updatedHtml = '';
76
-
77
- if (config.pathSubdirectory && config.pathSubdirectory.length > 0) {
78
- updatedHtml = html
79
- .replace(/(src|data-load)="\/?src\//g, `$1="${config.pathSubdirectory}`)
80
- .replace(/(src|data-load|href)="\/?assets\//g, `$1="${config.pathSubdirectory}assets/`)
81
- .replace(/(src|data-load|href)="\/?resources\//g, `$1="${config.pathSubdirectory}resources/`)
82
- } else {
83
- updatedHtml = html.replace(/(src|data-load)="\/?src\//g, '$1="/');
84
- }
85
-
86
- await fs.promises.writeFile(file, updatedHtml);
87
- }
88
- },
89
- apply: 'build',
90
- }
42
+ replaceSrcPaths(config),
91
43
  ],
92
44
  define: {
93
45
  'process.env': process.env
@@ -1,308 +0,0 @@
1
- $button-border-radius: 2px !default;
2
- $button-cursor: pointer !default;
3
- $button-display: inline-block !default;
4
- $button-font-family: $base-font-family !default;
5
- $button-font-size: 1.25rem !default;
6
- $button-font-size-desktop: $button-font-size !default;
7
- $button-font-style: normal !default;
8
- $button-font-weight: 700 !default;
9
- $button-height: 50px !default;
10
- $button-height-desktop: $button-height !default;
11
- $button-letter-spacing: 0 !default;
12
- $button-line-height: 1.05 !default;
13
- $button-margin: 10px 0 !default;
14
- $button-padding: 15px 30px !default;
15
- $button-position: relative !default;
16
- $button-text-align: center !default;
17
- $button-text-decoration: none !default;
18
- $button-text-transform: uppercase !default;
19
- $button-transition: color .15s ease-in-out, background-color .15s ease-in-out, border .15s ease-in-out !default;
20
- $button-width: 100% !default;
21
- $button-z-index: 0 !default;
22
-
23
- $back-button-align-items: center !default;
24
- $back-button-background-color: transparent !default;
25
- $back-button-border: 0 !default;
26
- $back-button-border-radius: 0 !default;
27
- $back-button-color: $color-charcoal4 !default;
28
- $back-button-display: flex !default;
29
- $back-button-initial-display: none !default;
30
- $back-button-font-size: .875rem !default;
31
- $back-button-font-weight: 400 !default;
32
- $back-button-height: auto !default;
33
- $back-button-line-height: $button-line-height !default;
34
- $back-button-margin: 10px 0 0 !default;
35
- $back-button-padding: 2px 5px !default;
36
- $back-button-margin-desktop: $back-button-margin !default;
37
- $back-button-padding-desktop: $back-button-padding !default;
38
- $back-button-hover-background-color: transparent !default;
39
- $back-button-hover-color: darken($back-button-color, 10%) !default;
40
- $back-button-icon-font-size: 90% !default;
41
- $back-button-icon-margin-right: 4px !default;
42
-
43
- $back-button-focus-outline: 1px solid rgba($back-button-color, .5) !default;
44
- $back-button-focus-outline-offset: 2px !default;
45
-
46
- $button-primary-background-color: $color-a11y-default-button !default;
47
- $button-primary-border: 0 !default;
48
- $button-primary-color: $color-white !default;
49
- $button-primary-font-family: $button-font-family !default;
50
- $button-primary-max-width: 100% !default;
51
- $button-primary-hover-background-color: $color-a11y-default-button-hover !default;
52
- $button-primary-hover-border: $button-primary-border !default;
53
- $button-primary-hover-color: $color-white !default;
54
-
55
- $button-secondary-background-color: $button-primary-background-color !default;
56
- $button-secondary-border: $button-primary-border !default;
57
- $button-secondary-color: $button-primary-color !default;
58
- $button-secondary-font-family: $button-font-family !default;
59
- $button-secondary-font-size: $button-font-size !default;
60
- $button-secondary-font-size-desktop: $button-secondary-font-size !default;
61
- $button-secondary-font-style: $button-font-style !default;
62
- $button-secondary-height: $button-height !default;
63
- $button-secondary-height-desktop: $button-secondary-height !default;
64
- $button-secondary-max-width: 100% !default;
65
- $button-secondary-padding: $button-padding !default;
66
- $button-secondary-text-transform: $button-text-transform !default;
67
- $button-secondary-hover-background-color: $button-primary-hover-background-color !default;
68
- $button-secondary-hover-border: $button-primary-hover-border !default;
69
- $button-secondary-hover-color: $button-primary-hover-color !default;
70
-
71
- $button-icon-position: absolute !default;
72
- $button-icon-font-family: 'modicons-fill' !default;
73
- $button-icon-font-size: .875rem !default;
74
- $button-icon-bottom: unset !default;
75
- $button-icon-left: unset !default;
76
- $button-icon-right: 15px !default;
77
- $button-icon-top: 50% !default;
78
- $button-icon-transform: translateY(-50%) !default;
79
-
80
- $button-spinner-default-easing: cubic-bezier(.4, .1, .5, 1);
81
- $button-spinner-default-border-color: $button-primary-background-color !default;
82
- $button-spinner-default-border-right-color: $color-white !default;
83
- $button-spinner-default-border-top-color: $button-spinner-default-border-right-color !default;
84
-
85
- $button-spinner-primary-border-color: $button-primary-background-color !default;
86
- $button-spinner-primary-border-right-color: $color-white !default;
87
- $button-spinner-primary-border-top-color: $button-spinner-default-border-right-color !default;
88
-
89
- $button-spinner-secondary-border-color: $button-secondary-background-color!default;
90
- $button-spinner-secondary-border-right-color: $color-white !default;
91
- $button-spinner-secondary-border-top-color: $button-spinner-default-border-right-color !default;
92
-
93
- @keyframes spinnerAnim {
94
- from { transform: rotate(0deg); }
95
- to { transform: rotate(360deg); }
96
- }
97
-
98
- .btn {
99
- border-radius: $button-border-radius;
100
- cursor: $button-cursor;
101
- display: $button-display;
102
- font-family: $button-font-family;
103
- font-size: $button-font-size;
104
- font-style: $button-font-style;
105
- font-weight: $button-font-weight;
106
- height: $button-height;
107
- letter-spacing: $button-letter-spacing;
108
- line-height: $button-line-height;
109
- margin: $button-margin;
110
- padding: $button-padding;
111
- position: $button-position;
112
- text-align: $button-text-align;
113
- text-decoration: $button-text-decoration;
114
- text-transform: $button-text-transform;
115
- transition: $button-transition;
116
- width: $button-width;
117
- z-index: $button-z-index;
118
-
119
- &__spinner {
120
- display: block;
121
- margin: 0 auto;
122
- height: 20px;
123
- left: 50%;
124
- opacity: 0;
125
- position: absolute;
126
- top: 50%;
127
- transform: translate(-50%, -50%);
128
- transition: opacity .1s $button-spinner-default-easing;
129
- visibility: hidden;
130
- width: 20px;
131
-
132
- &::before {
133
- content: '';
134
- display: inline-block;
135
- height: 100%;
136
- vertical-align: middle;
137
- }
138
-
139
- &::after {
140
- animation: spinnerAnim 1.5s linear infinite;
141
- border: 4px solid darken($button-spinner-default-border-color, 20);
142
- border-radius: 50%;
143
- border-right-color: $button-spinner-default-border-right-color;
144
- border-top-color: $button-spinner-default-border-top-color;
145
- content: '';
146
- display: block;
147
- height: 100%;
148
- left: 0;
149
- position: absolute;
150
- top: 0;
151
- width: 100%;
152
- }
153
- }
154
-
155
- &__icon {
156
- bottom: $button-icon-bottom;
157
- font-family: $button-icon-font-family;
158
- font-size: $button-icon-font-size;
159
- left: $button-icon-left;
160
- position: $button-icon-position;
161
- right: $button-icon-right;
162
- top: $button-icon-top;
163
- transform: $button-icon-transform;
164
- }
165
-
166
- &--back {
167
- align-items: $back-button-align-items;
168
- background-color: $back-button-background-color;
169
- border: $back-button-border;
170
- border-radius: $back-button-border-radius;
171
- color: $back-button-color;
172
- cursor: $button-cursor;
173
- display: $back-button-initial-display;
174
- font-size: $back-button-font-size;
175
- font-family: $button-font-family;
176
- font-weight: $back-button-font-weight;
177
- height: $back-button-height;
178
- line-height: $back-button-line-height;
179
- margin: $back-button-margin;
180
- padding: $back-button-padding;
181
- transition: $button-transition;
182
-
183
- i {
184
- font-size: $back-button-icon-font-size;
185
- margin-right: $back-button-icon-margin-right;
186
- }
187
-
188
- &:focus {
189
- outline: $back-button-focus-outline;
190
- outline-offset: $back-button-focus-outline-offset;
191
- }
192
- }
193
-
194
- &--primary {
195
- background-color: $button-primary-background-color;
196
- border: $button-primary-border;
197
- color: $button-primary-color;
198
- font-family: $button-primary-font-family;
199
- max-width: $button-primary-max-width;
200
-
201
- .btn__spinner {
202
- &::after {
203
- border: 4px solid darken($button-spinner-primary-border-color, 20);
204
- border-right-color: $button-spinner-primary-border-right-color;
205
- border-top-color: $button-spinner-primary-border-top-color;
206
- }
207
- }
208
- }
209
-
210
- &--secondary {
211
- background-color: $button-secondary-background-color;
212
- border: $button-secondary-border;
213
- color: $button-secondary-color;
214
- font-family: $button-secondary-font-family;
215
- font-size: $button-secondary-font-size;
216
- font-style: $button-secondary-font-style;
217
- height: $button-secondary-height;
218
- max-width: $button-secondary-max-width;
219
- padding: $button-secondary-padding;
220
- text-transform: $button-secondary-text-transform;
221
-
222
- .btn__spinner {
223
- &::after {
224
- border: 4px solid darken($button-spinner-secondary-border-color, 20);
225
- border-right-color: $button-spinner-secondary-border-right-color;
226
- border-top-color: $button-spinner-secondary-border-top-color;
227
- }
228
- }
229
- }
230
-
231
- &--loading {
232
- cursor: wait;
233
-
234
- .btn__text {
235
- visibility: hidden;
236
- }
237
-
238
- .btn__spinner {
239
- opacity: 1;
240
- visibility: visible;
241
- }
242
- }
243
- }
244
-
245
- .form--loading {
246
- .btn {
247
- cursor: wait;
248
-
249
- &__text {
250
- visibility: hidden;
251
- }
252
-
253
- &__spinner {
254
- opacity: 1;
255
- visibility: visible;
256
- }
257
- }
258
- }
259
-
260
- .form-in-progress {
261
- .btn--back {
262
- display: $back-button-display;
263
- }
264
- }
265
-
266
- @include breakpoint-md {
267
- .btn {
268
- font-size: $button-font-size-desktop;
269
- height: $button-height-desktop;
270
-
271
- &--back {
272
- margin: $back-button-margin-desktop;
273
- padding: $back-button-padding-desktop;
274
-
275
- &:hover,
276
- &:active,
277
- &:focus {
278
- background-color: $back-button-hover-background-color;
279
- color: $back-button-hover-color;
280
- }
281
- }
282
-
283
- &--primary {
284
- &:hover,
285
- &:active,
286
- &:focus {
287
- background-color: $button-primary-hover-background-color;
288
- border: $button-primary-hover-border;
289
- color: $button-primary-hover-color;
290
- }
291
-
292
- }
293
-
294
- &--secondary {
295
- font-size: $button-secondary-font-size-desktop;
296
- height: $button-secondary-height-desktop;
297
-
298
- &:hover,
299
- &:active,
300
- &:focus {
301
- background-color: $button-secondary-hover-background-color;
302
- border: $button-secondary-hover-border;
303
- color: $button-secondary-hover-color;
304
- }
305
-
306
- }
307
- }
308
- }
@@ -1,8 +0,0 @@
1
- <button class="btn--back back-btn{{#if class}} {{class}}{{/if}}" data-btn="back" type="button">
2
- <i class="{{#if icon}}{{icon}}{{else}}icon-caret-left{{/if}}"></i>
3
- {{#if iconOnly}}
4
- <span class="visually-hidden">Back</span>
5
- {{else}}
6
- Back
7
- {{/if}}
8
- </button>
@@ -1,17 +0,0 @@
1
- {{#xif 'this.button.tag && this.button.tag === "a"'}}
2
- <a class="btn{{#xif 'this.button.attributes && this.button.attributes.class || this.class'}}{{#if this.button.attributes.class}} {{this.button.attributes.class}}{{/if}}{{#if this.class}} {{this.class}}{{/if}}{{/xif}}" {{{addAttributes this.button 'class'}}}>
3
- {{else}}
4
- <button class="btn{{#xif 'this.button.attributes && this.button.attributes.class'}} {{this.button.attributes.class}}{{/xif}}" {{{addAttributes this.button 'class'}}}>
5
- {{/xif}}
6
- <span class="btn__text">{{{this.button.text}}}</span>
7
- {{#if this.button.icon}}
8
- <i class="btn__icon{{#xif 'this.button.icon.attributes && this.button.icon.attributes.class'}} {{this.button.icon.attributes.class}}{{/xif}}" {{{addAttributes this.button.icon 'class'}}}></i>
9
- {{/if}}
10
- {{#xif 'this.button.tag && this.button.tag === "a"'}}
11
- </a>
12
- {{else}}
13
- {{#unless this.button.hideSpinner}}
14
- <span class="btn__spinner"></span>
15
- {{/unless}}
16
- </button>
17
- {{/xif}}