mod-build 3.6.44-beta.2 → 3.6.44-beta.4
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/gulp-tasks/build.js
CHANGED
|
@@ -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,26 @@
|
|
|
1
|
+
var replace = require('gulp-replace');
|
|
2
|
+
|
|
3
|
+
module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
4
|
+
return function() {
|
|
5
|
+
if (siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory) {
|
|
6
|
+
const pathSubdirectory = siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory;
|
|
7
|
+
|
|
8
|
+
console.log(pathSubdirectory);
|
|
9
|
+
|
|
10
|
+
return gulp.src(siteSettings.distFolder + '/**/*.html')
|
|
11
|
+
.pipe(replace(/((src=")(images|scripts|shared-components)\/[^"]+")/g, function(match, path) {
|
|
12
|
+
if (path.startsWith('src="images') || path.startsWith('src="scripts') || path.startsWith('src="shared-components')) {
|
|
13
|
+
return 'src="/spn/' + path.slice(5);
|
|
14
|
+
}
|
|
15
|
+
return match;
|
|
16
|
+
}))
|
|
17
|
+
.pipe(replace(/((href=")(images|styles|shared-components)\/[^"]+")/g, function(match, path) {
|
|
18
|
+
if (path.startsWith('href="images') || path.startsWith('href="styles') || path.startsWith('href="shared-components')) {
|
|
19
|
+
return 'href="/spn/' + path.slice(6);
|
|
20
|
+
}
|
|
21
|
+
return match;
|
|
22
|
+
}))
|
|
23
|
+
.pipe(gulp.dest(siteSettings.distFolder));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
package/gulp-tasks/tasks.js
CHANGED
|
@@ -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) {
|