@videinfra/static-website-builder 2.0.2 → 2.0.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/.prettierrc +11 -11
- package/CHANGELOG.md +214 -210
- package/README.md +102 -102
- package/bin/builder.js +40 -40
- package/eslint.config.js +39 -39
- package/gulpfile.js +63 -63
- package/init/default/config/config.js +44 -44
- package/init/default/src/html/data/global.js +9 -9
- package/init/default/src/javascripts/_entries.js +14 -14
- package/init/index.js +63 -63
- package/init/test/.env +6 -6
- package/init/test/.env.local +3 -2
- package/init/test/config/config.js +71 -67
- package/init/test/src/html/404.twig +12 -12
- package/init/test/src/html/data/global.js +10 -10
- package/init/test/src/html/env.twig +21 -21
- package/init/test/src/html/layouts/base.twig +1 -1
- package/init/test/src/html/other.twig +9 -9
- package/init/test/src/html/preposition.twig +4 -4
- package/init/test/src/javascripts/_entries-alt.js +10 -10
- package/init/test/src/javascripts/_entries.js +19 -19
- package/init/test/src/javascripts/common.js +13 -13
- package/init/test/src/javascripts/main.js +8 -8
- package/init/test/src/javascripts/something.ts +9 -9
- package/init/test/src/stylesheets/autoprefixer-test.scss +3 -3
- package/init/test/src/stylesheets/env-test.scss +28 -28
- package/init/test/src/stylesheets/ignore-test.scss +4 -4
- package/init/test/src/stylesheets/nested-calc-test.scss +3 -3
- package/init/test/src/stylesheets/sub-folder/import-test.scss +2 -2
- package/lib/camelize-file-name.js +21 -21
- package/lib/generate-gulp-tasks.js +85 -85
- package/lib/get-config.js +203 -204
- package/lib/get-file-names.js +23 -23
- package/lib/get-path.js +102 -102
- package/lib/globs-helper.js +243 -243
- package/lib/gulp/dynamic-task.js +8 -8
- package/lib/gulp/resolve-dynamic-task.js +11 -11
- package/lib/gulp/task-before-dest.js +8 -8
- package/lib/gulp/task-end.js +10 -10
- package/lib/gulp/task-start.js +12 -12
- package/lib/gulp/task-watch.js +66 -66
- package/lib/init/copy-folder.js +50 -50
- package/lib/init/folder-exists.js +10 -10
- package/lib/init/get-folder-list.js +16 -16
- package/lib/init/merge-package.js +17 -17
- package/lib/init/read-package.js +17 -17
- package/lib/log-error.js +15 -15
- package/lib/merge.js +27 -27
- package/lib/run-preprocess.js +32 -32
- package/lib/task-order.js +19 -19
- package/package.json +68 -68
- package/plugins/example/preprocess-config.js +17 -17
- package/plugins/example/task.js +55 -55
- package/plugins/example.js +38 -38
- package/plugins/sass-engine/preprocess-config.js +59 -59
- package/plugins/sass.js +41 -41
- package/plugins/twig/lodash-filters/filters.js +91 -91
- package/plugins/twig/lodash-filters.js +14 -14
- package/plugins/twig/symfony-filters/filters.js +102 -102
- package/plugins/twig/symfony-filters/preposition_nbsp.js +77 -77
- package/plugins/twig/symfony-filters.js +14 -14
- package/plugins/twig/symfony-functions/functions.js +31 -31
- package/plugins/twig/symfony-functions.js +14 -14
- package/plugins/twig-engine/preprocess-config.js +53 -53
- package/plugins/twig.js +74 -74
- package/tasks/browser-sync/config.js +39 -39
- package/tasks/browser-sync/preprocess-config.js +32 -32
- package/tasks/browser-sync/task.js +9 -9
- package/tasks/clean/config.js +20 -20
- package/tasks/clean/preprocess-config.js +19 -19
- package/tasks/clean/task.js +7 -7
- package/tasks/data/config.js +34 -34
- package/tasks/data/data-loader-js.js +14 -14
- package/tasks/data/data-loader-json.js +5 -5
- package/tasks/data/get-data.js +96 -96
- package/tasks/env/config.js +26 -23
- package/tasks/env/get-env.js +113 -81
- package/tasks/fonts/config.js +24 -24
- package/tasks/fonts/task.js +47 -47
- package/tasks/global/config.js +7 -7
- package/tasks/html/config.js +42 -42
- package/tasks/html/task.js +91 -91
- package/tasks/icons/config.js +47 -47
- package/tasks/icons/preprocess-config.js +60 -60
- package/tasks/icons/task.js +56 -56
- package/tasks/images/config.js +27 -27
- package/tasks/images/task.js +46 -46
- package/tasks/javascripts/config.js +69 -69
- package/tasks/javascripts/preprocess-config.js +109 -109
- package/tasks/javascripts/task.js +86 -86
- package/tasks/sitemap/config.js +48 -48
- package/tasks/sitemap/preprocess-config.js +18 -18
- package/tasks/sitemap/task.js +69 -69
- package/tasks/sizereport/config.js +23 -23
- package/tasks/sizereport/task.js +16 -16
- package/tasks/static/config.js +27 -27
- package/tasks/static/task.js +46 -46
- package/tasks/stylesheets/config.js +85 -85
- package/tasks/stylesheets/preprocess-config.js +41 -41
- package/tasks/stylesheets/task.js +73 -73
- package/tests/build/build.test.js +153 -153
- package/tests/camelize-file-name.test.js +11 -11
- package/tests/generate-gulp-tasks.test.js +78 -78
- package/tests/glob-helper.test.js +99 -99
- package/tests/merge.test.js +10 -10
- package/tests/preposition_nbsp.test.js +50 -50
- package/tests/run-preprocess.test.js +90 -90
- package/tests/sass-stringify.test.js +24 -24
- package/tests/sitemap.test.js +12 -12
- package/vendor/gulp-rolldown/index.js +151 -151
- package/vendor/gulp-rolldown/plugin-raw.js +17 -17
- package/vendor/gulp-rolldown/plugin-virtual-entry.js +30 -30
- package/vendor/gulp-sass/CHANGELOG.md +168 -168
- package/vendor/gulp-sass/LICENSE +20 -20
- package/vendor/gulp-sass/README.md +187 -187
- package/vendor/gulp-sass/index.js +208 -208
- package/vendor/gulp-sass/package.json +61 -61
- package/vendor/gulp-sass/sass-stringify.js +32 -32
- package/vendor/gulp-twig/LICENSE +20 -20
- package/vendor/gulp-twig/README.md +167 -167
- package/vendor/gulp-twig/index.js +138 -138
- package/vendor/gulp-twig/package.json +44 -44
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import gulp from 'gulp';
|
|
2
|
-
import { parallel } from 'gulp';
|
|
3
|
-
import nanomemoize from 'nano-memoize';
|
|
4
|
-
import gulpRolldown from '../../vendor/gulp-rolldown/index.js';
|
|
5
|
-
|
|
6
|
-
import merge from '../../lib/merge.js';
|
|
7
|
-
import globs from './../../lib/globs-helper.js';
|
|
8
|
-
import { getSourcePaths, getDestPath } from './../../lib/get-path.js';
|
|
9
|
-
import { getTaskConfig } from './../../lib/get-config.js';
|
|
10
|
-
|
|
11
|
-
import taskStart from '../../lib/gulp/task-start.js';
|
|
12
|
-
import taskEnd from '../../lib/gulp/task-end.js';
|
|
13
|
-
import taskBeforeDest from '../../lib/gulp/task-before-dest.js';
|
|
14
|
-
import taskWatch from '../../lib/gulp/task-watch.js';
|
|
15
|
-
import dynamicTask from '../../lib/gulp/dynamic-task.js';
|
|
16
|
-
|
|
17
|
-
const getGlobPaths = nanomemoize.nanomemoize(function () {
|
|
18
|
-
const sourcePaths = getSourcePaths('javascripts');
|
|
19
|
-
const extensions = getTaskConfig('javascripts', '0', 'rolldown', 'resolve', 'extensions');
|
|
20
|
-
|
|
21
|
-
return globs.generate(
|
|
22
|
-
globs.paths(sourcePaths).filesWithExtensions(extensions), // Files to watch
|
|
23
|
-
);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const getWatchGlobPaths = nanomemoize.nanomemoize(function () {
|
|
27
|
-
const sourcePaths = getSourcePaths('javascripts');
|
|
28
|
-
const entries = getTaskConfig('javascripts', '0', 'entryList');
|
|
29
|
-
|
|
30
|
-
// Watch only or entry files; rolldown will watch all other files
|
|
31
|
-
const entryFileNamesNames = entries.map((entry) => entry.name);
|
|
32
|
-
|
|
33
|
-
return globs.generate(globs.paths(sourcePaths).paths(entryFileNamesNames), true);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
function javascripts(watch) {
|
|
37
|
-
const configs = getTaskConfig('javascripts');
|
|
38
|
-
|
|
39
|
-
// Configs is an array, for each of the entry files separate config is created
|
|
40
|
-
const tasks = configs.map(function (config, index) {
|
|
41
|
-
// Gulp task function
|
|
42
|
-
const fn = function () {
|
|
43
|
-
const rolldownConfig = merge(config.rolldown);
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
gulp
|
|
47
|
-
.src(getGlobPaths())
|
|
48
|
-
.pipe(taskStart())
|
|
49
|
-
|
|
50
|
-
.pipe(gulpRolldown(rolldownConfig, rolldownConfig.output))
|
|
51
|
-
|
|
52
|
-
.pipe(taskBeforeDest())
|
|
53
|
-
.pipe(gulp.dest(getDestPath('javascripts')))
|
|
54
|
-
|
|
55
|
-
// Reload on change
|
|
56
|
-
.pipe(taskEnd())
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// Set name of the gulp task function, currently it doesn't have a name yet
|
|
61
|
-
// This is needed so that name appears in terminal when running build
|
|
62
|
-
let name = 'javascripts' + (watch ? 'Watch' : '');
|
|
63
|
-
|
|
64
|
-
if (configs.length > 1) {
|
|
65
|
-
let entryFileName = config.rolldown.entries.name.replace('.json', '').replace('.js', '');
|
|
66
|
-
name += entryFileName[0].toUpperCase() + entryFileName.slice(1);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
Object.defineProperty(fn, 'name', { value: name });
|
|
70
|
-
|
|
71
|
-
return fn;
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
return parallel(...tasks);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function javascriptsWatch() {
|
|
78
|
-
return function javascriptsWatch() {
|
|
79
|
-
// We need to watch only entry files, all other files are being watched by rolldown
|
|
80
|
-
return taskWatch(getWatchGlobPaths(), javascripts(true), true);
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Dynamic task will be executed when config is ready and must return gulp tasks
|
|
85
|
-
export const build = dynamicTask(javascripts);
|
|
86
|
-
export const watch = dynamicTask(javascriptsWatch);
|
|
1
|
+
import gulp from 'gulp';
|
|
2
|
+
import { parallel } from 'gulp';
|
|
3
|
+
import nanomemoize from 'nano-memoize';
|
|
4
|
+
import gulpRolldown from '../../vendor/gulp-rolldown/index.js';
|
|
5
|
+
|
|
6
|
+
import merge from '../../lib/merge.js';
|
|
7
|
+
import globs from './../../lib/globs-helper.js';
|
|
8
|
+
import { getSourcePaths, getDestPath } from './../../lib/get-path.js';
|
|
9
|
+
import { getTaskConfig } from './../../lib/get-config.js';
|
|
10
|
+
|
|
11
|
+
import taskStart from '../../lib/gulp/task-start.js';
|
|
12
|
+
import taskEnd from '../../lib/gulp/task-end.js';
|
|
13
|
+
import taskBeforeDest from '../../lib/gulp/task-before-dest.js';
|
|
14
|
+
import taskWatch from '../../lib/gulp/task-watch.js';
|
|
15
|
+
import dynamicTask from '../../lib/gulp/dynamic-task.js';
|
|
16
|
+
|
|
17
|
+
const getGlobPaths = nanomemoize.nanomemoize(function () {
|
|
18
|
+
const sourcePaths = getSourcePaths('javascripts');
|
|
19
|
+
const extensions = getTaskConfig('javascripts', '0', 'rolldown', 'resolve', 'extensions');
|
|
20
|
+
|
|
21
|
+
return globs.generate(
|
|
22
|
+
globs.paths(sourcePaths).filesWithExtensions(extensions), // Files to watch
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const getWatchGlobPaths = nanomemoize.nanomemoize(function () {
|
|
27
|
+
const sourcePaths = getSourcePaths('javascripts');
|
|
28
|
+
const entries = getTaskConfig('javascripts', '0', 'entryList');
|
|
29
|
+
|
|
30
|
+
// Watch only or entry files; rolldown will watch all other files
|
|
31
|
+
const entryFileNamesNames = entries.map((entry) => entry.name);
|
|
32
|
+
|
|
33
|
+
return globs.generate(globs.paths(sourcePaths).paths(entryFileNamesNames), true);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
function javascripts(watch) {
|
|
37
|
+
const configs = getTaskConfig('javascripts');
|
|
38
|
+
|
|
39
|
+
// Configs is an array, for each of the entry files separate config is created
|
|
40
|
+
const tasks = configs.map(function (config, index) {
|
|
41
|
+
// Gulp task function
|
|
42
|
+
const fn = function () {
|
|
43
|
+
const rolldownConfig = merge(config.rolldown);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
gulp
|
|
47
|
+
.src(getGlobPaths())
|
|
48
|
+
.pipe(taskStart())
|
|
49
|
+
|
|
50
|
+
.pipe(gulpRolldown(rolldownConfig, rolldownConfig.output))
|
|
51
|
+
|
|
52
|
+
.pipe(taskBeforeDest())
|
|
53
|
+
.pipe(gulp.dest(getDestPath('javascripts')))
|
|
54
|
+
|
|
55
|
+
// Reload on change
|
|
56
|
+
.pipe(taskEnd())
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Set name of the gulp task function, currently it doesn't have a name yet
|
|
61
|
+
// This is needed so that name appears in terminal when running build
|
|
62
|
+
let name = 'javascripts' + (watch ? 'Watch' : '');
|
|
63
|
+
|
|
64
|
+
if (configs.length > 1) {
|
|
65
|
+
let entryFileName = config.rolldown.entries.name.replace('.json', '').replace('.js', '');
|
|
66
|
+
name += entryFileName[0].toUpperCase() + entryFileName.slice(1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Object.defineProperty(fn, 'name', { value: name });
|
|
70
|
+
|
|
71
|
+
return fn;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return parallel(...tasks);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function javascriptsWatch() {
|
|
78
|
+
return function javascriptsWatch() {
|
|
79
|
+
// We need to watch only entry files, all other files are being watched by rolldown
|
|
80
|
+
return taskWatch(getWatchGlobPaths(), javascripts(true), true);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Dynamic task will be executed when config is ready and must return gulp tasks
|
|
85
|
+
export const build = dynamicTask(javascripts);
|
|
86
|
+
export const watch = dynamicTask(javascriptsWatch);
|
package/tasks/sitemap/config.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import * as sitemapTask from './task.js';
|
|
2
|
-
import * as preprocessSitemapConfig from './preprocess-config.js';
|
|
3
|
-
|
|
4
|
-
export const sitemap = {
|
|
5
|
-
// Add twig to the extensions
|
|
6
|
-
extensions: ['html'],
|
|
7
|
-
|
|
8
|
-
// Glob list of files, which to ignore
|
|
9
|
-
// see https://gulpjs.com/docs/en/getting-started/explaining-globs/
|
|
10
|
-
ignore: [],
|
|
11
|
-
|
|
12
|
-
// Gulp sitemap specific settings
|
|
13
|
-
sitemap: {
|
|
14
|
-
// Skip noindex pages
|
|
15
|
-
noindex: true,
|
|
16
|
-
|
|
17
|
-
// Change frequency
|
|
18
|
-
changefreq: 'daily',
|
|
19
|
-
|
|
20
|
-
// Custom priority function
|
|
21
|
-
priority: function (siteUrl, loc, entry) {
|
|
22
|
-
return loc === siteUrl ? 1 : 0.9;
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
// Production only settings, overwrites default settings
|
|
27
|
-
production: {},
|
|
28
|
-
|
|
29
|
-
// Development only settings, overwrites default settings
|
|
30
|
-
development: {},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const tasks = {
|
|
34
|
-
sitemap: [sitemapTask],
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const preprocess = {
|
|
38
|
-
sitemap: [preprocessSitemapConfig],
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Paths relative to the global src and dest folders
|
|
43
|
-
*/
|
|
44
|
-
export const paths = {
|
|
45
|
-
sitemap: {
|
|
46
|
-
dest: '',
|
|
47
|
-
},
|
|
48
|
-
};
|
|
1
|
+
import * as sitemapTask from './task.js';
|
|
2
|
+
import * as preprocessSitemapConfig from './preprocess-config.js';
|
|
3
|
+
|
|
4
|
+
export const sitemap = {
|
|
5
|
+
// Add twig to the extensions
|
|
6
|
+
extensions: ['html'],
|
|
7
|
+
|
|
8
|
+
// Glob list of files, which to ignore
|
|
9
|
+
// see https://gulpjs.com/docs/en/getting-started/explaining-globs/
|
|
10
|
+
ignore: [],
|
|
11
|
+
|
|
12
|
+
// Gulp sitemap specific settings
|
|
13
|
+
sitemap: {
|
|
14
|
+
// Skip noindex pages
|
|
15
|
+
noindex: true,
|
|
16
|
+
|
|
17
|
+
// Change frequency
|
|
18
|
+
changefreq: 'daily',
|
|
19
|
+
|
|
20
|
+
// Custom priority function
|
|
21
|
+
priority: function (siteUrl, loc, entry) {
|
|
22
|
+
return loc === siteUrl ? 1 : 0.9;
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
// Production only settings, overwrites default settings
|
|
27
|
+
production: {},
|
|
28
|
+
|
|
29
|
+
// Development only settings, overwrites default settings
|
|
30
|
+
development: {},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const tasks = {
|
|
34
|
+
sitemap: [sitemapTask],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const preprocess = {
|
|
38
|
+
sitemap: [preprocessSitemapConfig],
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Paths relative to the global src and dest folders
|
|
43
|
+
*/
|
|
44
|
+
export const paths = {
|
|
45
|
+
sitemap: {
|
|
46
|
+
dest: '',
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import getEnvData from '../env/get-env.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Modify configuration
|
|
5
|
-
*
|
|
6
|
-
* @param {object} config Sitemap configuration
|
|
7
|
-
* @param {object} fullConfig Full configuration
|
|
8
|
-
* @returns {object} Transformed sitemap configuration
|
|
9
|
-
*/
|
|
10
|
-
export default function preprocessSitemapConfig (config = {}, fullConfig) {
|
|
11
|
-
const envData = getEnvData();
|
|
12
|
-
|
|
13
|
-
// Set host
|
|
14
|
-
config.sitemap = config.sitemap || {};
|
|
15
|
-
config.sitemap.siteUrl = envData.env.host;
|
|
16
|
-
|
|
17
|
-
return config;
|
|
18
|
-
}
|
|
1
|
+
import getEnvData from '../env/get-env.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Modify configuration
|
|
5
|
+
*
|
|
6
|
+
* @param {object} config Sitemap configuration
|
|
7
|
+
* @param {object} fullConfig Full configuration
|
|
8
|
+
* @returns {object} Transformed sitemap configuration
|
|
9
|
+
*/
|
|
10
|
+
export default function preprocessSitemapConfig (config = {}, fullConfig) {
|
|
11
|
+
const envData = getEnvData();
|
|
12
|
+
|
|
13
|
+
// Set host
|
|
14
|
+
config.sitemap = config.sitemap || {};
|
|
15
|
+
config.sitemap.siteUrl = envData.env.host;
|
|
16
|
+
|
|
17
|
+
return config;
|
|
18
|
+
}
|
package/tasks/sitemap/task.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import gulp from 'gulp';
|
|
2
|
-
import gulpif from 'gulp-if';
|
|
3
|
-
import nanomemoize from 'nano-memoize';
|
|
4
|
-
import ignore from 'gulp-ignore';
|
|
5
|
-
import gulpSitemap from 'gulp-sitemap';
|
|
6
|
-
|
|
7
|
-
import { getDestPath } from './../../lib/get-path.js';
|
|
8
|
-
import { getTaskConfig } from './../../lib/get-config.js';
|
|
9
|
-
import globs from './../../lib/globs-helper.js';
|
|
10
|
-
|
|
11
|
-
import taskStart from '../../lib/gulp/task-start.js';
|
|
12
|
-
import taskEnd from '../../lib/gulp/task-end.js';
|
|
13
|
-
import taskBeforeDest from '../../lib/gulp/task-before-dest.js';
|
|
14
|
-
import taskWatch from '../../lib/gulp/task-watch.js';
|
|
15
|
-
|
|
16
|
-
const getWatchGlobPaths = function (forChokidar = false) {
|
|
17
|
-
const sourcePaths = getDestPath('html');
|
|
18
|
-
const extensions = getTaskConfig('sitemap', 'extensions');
|
|
19
|
-
|
|
20
|
-
return globs.generate(
|
|
21
|
-
[
|
|
22
|
-
globs.paths(sourcePaths).filesWithExtensions(extensions), // HTML files
|
|
23
|
-
globs.paths(gulp.dest(getDestPath('sitemap', 'sitemap.xml'))).ignore(),
|
|
24
|
-
],
|
|
25
|
-
forChokidar,
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
const getGlobPaths = nanomemoize.nanomemoize(function () {
|
|
29
|
-
return getWatchGlobPaths(false);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const getGlobIgnorePaths = nanomemoize.nanomemoize(function () {
|
|
33
|
-
const ignore = getTaskConfig('sitemap', 'ignore');
|
|
34
|
-
|
|
35
|
-
return globs.generate([
|
|
36
|
-
globs.paths(ignore), // Exclude files and folders from being rendered
|
|
37
|
-
]);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
function sitemap() {
|
|
41
|
-
return (
|
|
42
|
-
gulp
|
|
43
|
-
.src(getGlobPaths())
|
|
44
|
-
.pipe(taskStart())
|
|
45
|
-
|
|
46
|
-
// Prevent file from being rendered if it's in the ignore list
|
|
47
|
-
.pipe(gulpif(!!getGlobIgnorePaths().length, ignore.exclude(getGlobIgnorePaths(), {})))
|
|
48
|
-
|
|
49
|
-
// Preprocess sitemap
|
|
50
|
-
.pipe(gulpSitemap(getTaskConfig('sitemap').sitemap))
|
|
51
|
-
|
|
52
|
-
.pipe(taskBeforeDest())
|
|
53
|
-
.pipe(gulp.dest(getDestPath('sitemap')))
|
|
54
|
-
|
|
55
|
-
// Reload on change
|
|
56
|
-
.pipe(taskEnd())
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function sitemapWatch() {
|
|
61
|
-
// Watch and execute immediatelly so that sitemap is generated on first run
|
|
62
|
-
return taskWatch(getWatchGlobPaths(true), sitemap) && sitemap();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Execute after HTML task
|
|
66
|
-
sitemapWatch.order = 1;
|
|
67
|
-
|
|
68
|
-
export const afterBuild = sitemap;
|
|
69
|
-
export const watch = sitemapWatch;
|
|
1
|
+
import gulp from 'gulp';
|
|
2
|
+
import gulpif from 'gulp-if';
|
|
3
|
+
import nanomemoize from 'nano-memoize';
|
|
4
|
+
import ignore from 'gulp-ignore';
|
|
5
|
+
import gulpSitemap from 'gulp-sitemap';
|
|
6
|
+
|
|
7
|
+
import { getDestPath } from './../../lib/get-path.js';
|
|
8
|
+
import { getTaskConfig } from './../../lib/get-config.js';
|
|
9
|
+
import globs from './../../lib/globs-helper.js';
|
|
10
|
+
|
|
11
|
+
import taskStart from '../../lib/gulp/task-start.js';
|
|
12
|
+
import taskEnd from '../../lib/gulp/task-end.js';
|
|
13
|
+
import taskBeforeDest from '../../lib/gulp/task-before-dest.js';
|
|
14
|
+
import taskWatch from '../../lib/gulp/task-watch.js';
|
|
15
|
+
|
|
16
|
+
const getWatchGlobPaths = function (forChokidar = false) {
|
|
17
|
+
const sourcePaths = getDestPath('html');
|
|
18
|
+
const extensions = getTaskConfig('sitemap', 'extensions');
|
|
19
|
+
|
|
20
|
+
return globs.generate(
|
|
21
|
+
[
|
|
22
|
+
globs.paths(sourcePaths).filesWithExtensions(extensions), // HTML files
|
|
23
|
+
globs.paths(gulp.dest(getDestPath('sitemap', 'sitemap.xml'))).ignore(),
|
|
24
|
+
],
|
|
25
|
+
forChokidar,
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
const getGlobPaths = nanomemoize.nanomemoize(function () {
|
|
29
|
+
return getWatchGlobPaths(false);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const getGlobIgnorePaths = nanomemoize.nanomemoize(function () {
|
|
33
|
+
const ignore = getTaskConfig('sitemap', 'ignore');
|
|
34
|
+
|
|
35
|
+
return globs.generate([
|
|
36
|
+
globs.paths(ignore), // Exclude files and folders from being rendered
|
|
37
|
+
]);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
function sitemap() {
|
|
41
|
+
return (
|
|
42
|
+
gulp
|
|
43
|
+
.src(getGlobPaths())
|
|
44
|
+
.pipe(taskStart())
|
|
45
|
+
|
|
46
|
+
// Prevent file from being rendered if it's in the ignore list
|
|
47
|
+
.pipe(gulpif(!!getGlobIgnorePaths().length, ignore.exclude(getGlobIgnorePaths(), {})))
|
|
48
|
+
|
|
49
|
+
// Preprocess sitemap
|
|
50
|
+
.pipe(gulpSitemap(getTaskConfig('sitemap').sitemap))
|
|
51
|
+
|
|
52
|
+
.pipe(taskBeforeDest())
|
|
53
|
+
.pipe(gulp.dest(getDestPath('sitemap')))
|
|
54
|
+
|
|
55
|
+
// Reload on change
|
|
56
|
+
.pipe(taskEnd())
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function sitemapWatch() {
|
|
61
|
+
// Watch and execute immediatelly so that sitemap is generated on first run
|
|
62
|
+
return taskWatch(getWatchGlobPaths(true), sitemap) && sitemap();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Execute after HTML task
|
|
66
|
+
sitemapWatch.order = 1;
|
|
67
|
+
|
|
68
|
+
export const afterBuild = sitemap;
|
|
69
|
+
export const watch = sitemapWatch;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import * as siteReportTask from './task.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Generates a size report for all files in the output folder
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export const sizereport = {
|
|
8
|
-
// Development only settings, overwrites default settings
|
|
9
|
-
// disabled for development mode
|
|
10
|
-
development: false,
|
|
11
|
-
|
|
12
|
-
// Production only settings, overwrites default settings
|
|
13
|
-
production: {
|
|
14
|
-
// see https://www.npmjs.com/package/gulp-sizereport#options
|
|
15
|
-
gzip: true
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const tasks = {
|
|
20
|
-
sizereport: [
|
|
21
|
-
siteReportTask,
|
|
22
|
-
]
|
|
23
|
-
};
|
|
1
|
+
import * as siteReportTask from './task.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generates a size report for all files in the output folder
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const sizereport = {
|
|
8
|
+
// Development only settings, overwrites default settings
|
|
9
|
+
// disabled for development mode
|
|
10
|
+
development: false,
|
|
11
|
+
|
|
12
|
+
// Production only settings, overwrites default settings
|
|
13
|
+
production: {
|
|
14
|
+
// see https://www.npmjs.com/package/gulp-sizereport#options
|
|
15
|
+
gzip: true
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const tasks = {
|
|
20
|
+
sizereport: [
|
|
21
|
+
siteReportTask,
|
|
22
|
+
]
|
|
23
|
+
};
|
package/tasks/sizereport/task.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import gulp from 'gulp';
|
|
2
|
-
import size from 'gulp-sizereport';
|
|
3
|
-
|
|
4
|
-
import globs from './../../lib/globs-helper.js';
|
|
5
|
-
import { getDestPath } from './../../lib/get-path.js';
|
|
6
|
-
import { getTaskConfig } from './../../lib/get-config.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function sizeReport () {
|
|
10
|
-
return gulp
|
|
11
|
-
.src(globs.paths(getDestPath()).allFiles().generate())
|
|
12
|
-
.pipe(size(getTaskConfig('sizereport')))
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export const afterBuild = sizeReport;
|
|
1
|
+
import gulp from 'gulp';
|
|
2
|
+
import size from 'gulp-sizereport';
|
|
3
|
+
|
|
4
|
+
import globs from './../../lib/globs-helper.js';
|
|
5
|
+
import { getDestPath } from './../../lib/get-path.js';
|
|
6
|
+
import { getTaskConfig } from './../../lib/get-config.js';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
function sizeReport () {
|
|
10
|
+
return gulp
|
|
11
|
+
.src(globs.paths(getDestPath()).allFiles().generate())
|
|
12
|
+
.pipe(size(getTaskConfig('sizereport')))
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export const afterBuild = sizeReport;
|
package/tasks/static/config.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import * as staticFilesTask from './task.js';
|
|
2
|
-
|
|
3
|
-
export const staticFiles = {
|
|
4
|
-
// Glob list of files, which to ignore, relative to the static source path
|
|
5
|
-
// see https://gulpjs.com/docs/en/getting-started/explaining-globs/
|
|
6
|
-
ignore: [],
|
|
7
|
-
|
|
8
|
-
// Production only settings, overwrites default settings
|
|
9
|
-
production: {},
|
|
10
|
-
|
|
11
|
-
// Development only settings, overwrites default settings
|
|
12
|
-
development: {},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const tasks = {
|
|
16
|
-
staticFiles: [staticFilesTask],
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Paths relative to the global src and dest folders
|
|
21
|
-
*/
|
|
22
|
-
export const paths = {
|
|
23
|
-
staticFiles: {
|
|
24
|
-
src: 'static',
|
|
25
|
-
dest: '',
|
|
26
|
-
},
|
|
27
|
-
};
|
|
1
|
+
import * as staticFilesTask from './task.js';
|
|
2
|
+
|
|
3
|
+
export const staticFiles = {
|
|
4
|
+
// Glob list of files, which to ignore, relative to the static source path
|
|
5
|
+
// see https://gulpjs.com/docs/en/getting-started/explaining-globs/
|
|
6
|
+
ignore: [],
|
|
7
|
+
|
|
8
|
+
// Production only settings, overwrites default settings
|
|
9
|
+
production: {},
|
|
10
|
+
|
|
11
|
+
// Development only settings, overwrites default settings
|
|
12
|
+
development: {},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const tasks = {
|
|
16
|
+
staticFiles: [staticFilesTask],
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Paths relative to the global src and dest folders
|
|
21
|
+
*/
|
|
22
|
+
export const paths = {
|
|
23
|
+
staticFiles: {
|
|
24
|
+
src: 'static',
|
|
25
|
+
dest: '',
|
|
26
|
+
},
|
|
27
|
+
};
|