mod-build 3.6.44-beta.2 → 3.6.44-beta.3

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.
@@ -5,15 +5,15 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
5
5
  var sequenceOpts;
6
6
 
7
7
  if (siteData.useTypescript) {
8
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'compile-prod', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'copy-resources-to-dist', 'build-stat'];
8
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'compile-prod', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'handle-path-subdirectories', 'copy-resources-to-dist', 'build-stat'];
9
9
  } else if (siteData.isWhiteLabel) {
10
10
  if (siteData.isQSPage) {
11
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'grab-theme-json', 'combine-files', 'grab-images', 'copy-json', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'copy-files-to-build-path', 'cache-bust', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
11
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'grab-theme-json', 'combine-files', 'grab-images', 'copy-json', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'copy-files-to-build-path', 'cache-bust', 'handle-path-subdirectories', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
12
12
  } else {
13
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'combine-files', 'grab-images', 'js-lint', 'html-min','grab-global-images', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
13
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'combine-files', 'grab-images', 'js-lint', 'html-min','grab-global-images', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'handle-path-subdirectories', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
14
14
  }
15
15
  } else {
16
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'copy-resources-to-dist', 'build-stat'];
16
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'handle-path-subdirectories', 'copy-resources-to-dist', 'build-stat'];
17
17
  }
18
18
 
19
19
  runSequence(...sequenceOpts, function() {
@@ -0,0 +1,18 @@
1
+ var replace = require('gulp-replace');
2
+
3
+ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
4
+ if (siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory) {
5
+ const pathSubdirectory = siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory;
6
+
7
+ console.log(pathSubdirectory);
8
+
9
+ return gulp.src(siteSettings.distFolder + '/**/*.html')
10
+ .pipe(replace(/((src="|href=")(images|resources|scripts|styles|shared-components)\/[^"]+")/g, function(match, path) {
11
+ if (path.startsWith('src="images') || path.startsWith('src="resources') || path.startsWith('src="scripts') || path.startsWith('src="shared-components') || path.startsWith('href="styles') || path.startsWith('href="shared-components')) {
12
+ return path + '/spn/"';
13
+ }
14
+ return match;
15
+ }))
16
+ .pipe(gulp.dest(siteSettings.distFolder));
17
+ }
18
+ };
@@ -360,7 +360,7 @@ module.exports = function() {
360
360
 
361
361
  return require(opts.gulpTasksFolderPath + '/grab-images')(opts.gulp, opts.gulpSettings, opts.siteData);
362
362
  }
363
- },
363
+ },
364
364
 
365
365
  // Get global images
366
366
  'grab-global-images': {
@@ -432,7 +432,7 @@ module.exports = function() {
432
432
 
433
433
  return require(opts.gulpTasksFolderPath + '/grab-tooltips-json')(opts.gulp, opts.gulpPlugins, opts.gulpSettings, opts.siteData);
434
434
  }
435
- },
435
+ },
436
436
 
437
437
  // copy resources directory into dist
438
438
  'copy-resources-to-dist': {
@@ -446,6 +446,18 @@ module.exports = function() {
446
446
  }
447
447
  },
448
448
 
449
+ // If siteData.pathSubdirectory exists...append the directory path to all of the existing relative URL paths
450
+ 'handle-path-subdirectories': {
451
+ subtasks: [],
452
+ func: function(opts) {
453
+ if ('undefined' === typeof opts.gulpTasksFolderPath) {
454
+ opts.gulpTasksFolderPath = '.';
455
+ }
456
+
457
+ return require(opts.gulpTasksFolderPath + '/handle-path-subdirectories')(opts.gulp, opts.gulpPlugins, opts.gulpSettings, opts.siteData);
458
+ }
459
+ },
460
+
449
461
  // Create a build
450
462
  'build': {
451
463
  func: function(opts) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.6.44-beta.2",
3
+ "version": "3.6.44-beta.3",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",