mod-build 3.6.44-beta.1 → 3.6.44-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.
@@ -19,16 +19,17 @@ const fileNames = {
19
19
  };
20
20
  var isQuotePageOrUseRelativePath = false;
21
21
  var resourceURL = '';
22
+ var pathSubdirectory = '';
22
23
 
23
24
  function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
24
- const resourcePath = isQuotePageOrUseRelativePath ? '{{#if this.src}}{{this.src}}{{/if}}resources/scripts/mod-alytics/' : '/resources/scripts/mod-alytics/';
25
+ const resourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}{{#if this.src}}{{this.src}}{{/if}}resources/scripts/mod-alytics/` : '/resources/scripts/mod-alytics/';
25
26
  return gulp.src(siteSettings.srcFolder + '/shared-components/head/head.html')
26
27
  .pipe(replace(/".*(modalytics).*"/, `"${resourcePath}${fileNames.modAlyticsFileName}"`))
27
28
  .pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/head'));
28
29
  }
29
30
  function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
30
31
  console.log('>> STARTING Replacing Foot Asset Scripts');
31
- const resourcePath = isQuotePageOrUseRelativePath ? '{{#if this.nodeModulesPath}}{{this.nodeModulesPath}}{{/if}}resources/scripts' : '/resources/scripts';
32
+ const resourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}{{#if this.nodeModulesPath}}{{this.nodeModulesPath}}{{/if}}resources/scripts` : '/resources/scripts';
32
33
  return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
33
34
  .pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"|"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"|"(?:(?!"|")[\s\S])+(mod-form\/mod-form.*?)js"|"(?:(?!"|")[\s\S])+(qs-form.*?)js"|"(?:(?!"|")[\s\S])+(mod-form\/form.*?)js"/g, function(match) {
34
35
  if (match.includes('mod-form')) {
@@ -51,8 +52,8 @@ function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
51
52
  });
52
53
  }
53
54
  function replaceAbandonmentJsCssSrc(gulp, gulpPlugins, siteSettings, siteData) {
54
- const jsResourcePath = isQuotePageOrUseRelativePath ? 'resources/scripts/abandonment/' : '/resources/scripts/abandonment/';
55
- const cssResourcePath = isQuotePageOrUseRelativePath ? 'resources/styles/components/abandonment/' : '/resources/styles/components/abandonment/';
55
+ const jsResourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}resources/scripts/abandonment/` : '/resources/scripts/abandonment/';
56
+ const cssResourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}resources/styles/components/abandonment/` : '/resources/styles/components/abandonment/';
56
57
  return gulp.src(siteSettings.srcFolder + '/templates/abandonment/*.html')
57
58
  .pipe(replace(/"(?:(?!"|")[\s\S])+(abandonment\/abandonment.*?)js"/, `"${jsResourcePath}${fileNames.abandonmentJsFileName}"`))
58
59
  .pipe(replace(/"(?:(?!"|")[\s\S])+(components\/abandonment\/abandonment.*?)css"/, `"${cssResourcePath}${fileNames.abandonmentStylesFileName}"`))
@@ -61,8 +62,8 @@ function replaceAbandonmentJsCssSrc(gulp, gulpPlugins, siteSettings, siteData) {
61
62
  function replaceFooterStylesReference(gulp, gulpPlugins, siteSettings, siteData) {
62
63
  if (siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
63
64
  return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/' + fileNames.footerComponentJsFileName)
64
- .pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/mod.*?)\)/, 'concat("resources/styles/components/footer/' + fileNames.modFooterStylesFileName + '")'))
65
- .pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/qs.*?)\)/, 'concat("resources/styles/components/footer/' + fileNames.qsFooterStylesFileName + '")'))
65
+ .pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/mod.*?)\)/, `concat("${pathSubdirectory}resources/styles/components/footer/` + fileNames.modFooterStylesFileName + '")'))
66
+ .pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/qs.*?)\)/, `concat("${pathSubdirectory}resources/styles/components/footer/` + fileNames.qsFooterStylesFileName + '")'))
66
67
  .pipe(gulp.dest(siteSettings.srcFolder + '/resources/scripts/footer'))
67
68
  } else if (!siteData.siteData || siteData.siteData && !siteData.siteData.isQuotePage) {
68
69
  return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/' + fileNames.footerComponentJsFileName)
@@ -74,8 +75,8 @@ function replaceFooterStylesReference(gulp, gulpPlugins, siteSettings, siteData)
74
75
  function replaceFooterStylesReferenceInMap(gulp, gulpPlugins, siteSettings, siteData) {
75
76
  if (siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
76
77
  return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/footer-component.min.js.map')
77
- .pipe(replace(/\`(?:(?!\`|\`)[\s\S])+(components\/footer\/mod.*?)\`/, '`resources/styles/components/footer/' + fileNames.modFooterStylesFileName + '`'))
78
- .pipe(replace(/\`(?:(?!\`|\`)[\s\S])+(components\/footer\/mod.*?)\`/, '`resources/styles/components/footer/' + fileNames.qsFooterStylesFileName + '`'))
78
+ .pipe(replace(/\`(?:(?!\`|\`)[\s\S])+(components\/footer\/mod.*?)\`/, '`' + pathSubdirectory + 'resources/styles/components/footer/' + fileNames.modFooterStylesFileName + '`'))
79
+ .pipe(replace(/\`(?:(?!\`|\`)[\s\S])+(components\/footer\/mod.*?)\`/, '`' + pathSubdirectory + 'resources/styles/components/footer/' + fileNames.qsFooterStylesFileName + '`'))
79
80
  .pipe(gulp.dest(siteSettings.srcFolder + '/resources/scripts/footer'));
80
81
  } else if (!siteData.siteData || siteData.siteData && !siteData.siteData.isQuotePage) {
81
82
  return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/footer-component.min.js.map')
@@ -248,10 +249,12 @@ const TASKS = {
248
249
  }
249
250
  };
250
251
  module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
252
+ const { isLocal } = siteSettings
251
253
  const isQuotePage = siteData.siteData && siteData.siteData.isQuotePage || siteData && siteData.isQuotePage;
252
254
  const useRelativePathForResources = siteData.siteData && siteData.siteData.useRelativePathForResources || siteData && siteData.useRelativePathForResources;
253
255
  isQuotePageOrUseRelativePath = isQuotePage === true || useRelativePathForResources === true;
254
256
  resourceURL = `https://${siteSettings.nodeEnv}/quote/resources`;
257
+ pathSubdirectory = isLocal ? '' : siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory;
255
258
  return function() {
256
259
  const { nodeEnv } = siteSettings;
257
260
  if (!nodeEnv) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.6.44-beta.1",
3
+ "version": "3.6.44-beta.2",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",