@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.
Files changed (122) hide show
  1. package/.prettierrc +11 -11
  2. package/CHANGELOG.md +214 -210
  3. package/README.md +102 -102
  4. package/bin/builder.js +40 -40
  5. package/eslint.config.js +39 -39
  6. package/gulpfile.js +63 -63
  7. package/init/default/config/config.js +44 -44
  8. package/init/default/src/html/data/global.js +9 -9
  9. package/init/default/src/javascripts/_entries.js +14 -14
  10. package/init/index.js +63 -63
  11. package/init/test/.env +6 -6
  12. package/init/test/.env.local +3 -2
  13. package/init/test/config/config.js +71 -67
  14. package/init/test/src/html/404.twig +12 -12
  15. package/init/test/src/html/data/global.js +10 -10
  16. package/init/test/src/html/env.twig +21 -21
  17. package/init/test/src/html/layouts/base.twig +1 -1
  18. package/init/test/src/html/other.twig +9 -9
  19. package/init/test/src/html/preposition.twig +4 -4
  20. package/init/test/src/javascripts/_entries-alt.js +10 -10
  21. package/init/test/src/javascripts/_entries.js +19 -19
  22. package/init/test/src/javascripts/common.js +13 -13
  23. package/init/test/src/javascripts/main.js +8 -8
  24. package/init/test/src/javascripts/something.ts +9 -9
  25. package/init/test/src/stylesheets/autoprefixer-test.scss +3 -3
  26. package/init/test/src/stylesheets/env-test.scss +28 -28
  27. package/init/test/src/stylesheets/ignore-test.scss +4 -4
  28. package/init/test/src/stylesheets/nested-calc-test.scss +3 -3
  29. package/init/test/src/stylesheets/sub-folder/import-test.scss +2 -2
  30. package/lib/camelize-file-name.js +21 -21
  31. package/lib/generate-gulp-tasks.js +85 -85
  32. package/lib/get-config.js +203 -204
  33. package/lib/get-file-names.js +23 -23
  34. package/lib/get-path.js +102 -102
  35. package/lib/globs-helper.js +243 -243
  36. package/lib/gulp/dynamic-task.js +8 -8
  37. package/lib/gulp/resolve-dynamic-task.js +11 -11
  38. package/lib/gulp/task-before-dest.js +8 -8
  39. package/lib/gulp/task-end.js +10 -10
  40. package/lib/gulp/task-start.js +12 -12
  41. package/lib/gulp/task-watch.js +66 -66
  42. package/lib/init/copy-folder.js +50 -50
  43. package/lib/init/folder-exists.js +10 -10
  44. package/lib/init/get-folder-list.js +16 -16
  45. package/lib/init/merge-package.js +17 -17
  46. package/lib/init/read-package.js +17 -17
  47. package/lib/log-error.js +15 -15
  48. package/lib/merge.js +27 -27
  49. package/lib/run-preprocess.js +32 -32
  50. package/lib/task-order.js +19 -19
  51. package/package.json +68 -68
  52. package/plugins/example/preprocess-config.js +17 -17
  53. package/plugins/example/task.js +55 -55
  54. package/plugins/example.js +38 -38
  55. package/plugins/sass-engine/preprocess-config.js +59 -59
  56. package/plugins/sass.js +41 -41
  57. package/plugins/twig/lodash-filters/filters.js +91 -91
  58. package/plugins/twig/lodash-filters.js +14 -14
  59. package/plugins/twig/symfony-filters/filters.js +102 -102
  60. package/plugins/twig/symfony-filters/preposition_nbsp.js +77 -77
  61. package/plugins/twig/symfony-filters.js +14 -14
  62. package/plugins/twig/symfony-functions/functions.js +31 -31
  63. package/plugins/twig/symfony-functions.js +14 -14
  64. package/plugins/twig-engine/preprocess-config.js +53 -53
  65. package/plugins/twig.js +74 -74
  66. package/tasks/browser-sync/config.js +39 -39
  67. package/tasks/browser-sync/preprocess-config.js +32 -32
  68. package/tasks/browser-sync/task.js +9 -9
  69. package/tasks/clean/config.js +20 -20
  70. package/tasks/clean/preprocess-config.js +19 -19
  71. package/tasks/clean/task.js +7 -7
  72. package/tasks/data/config.js +34 -34
  73. package/tasks/data/data-loader-js.js +14 -14
  74. package/tasks/data/data-loader-json.js +5 -5
  75. package/tasks/data/get-data.js +96 -96
  76. package/tasks/env/config.js +26 -23
  77. package/tasks/env/get-env.js +113 -81
  78. package/tasks/fonts/config.js +24 -24
  79. package/tasks/fonts/task.js +47 -47
  80. package/tasks/global/config.js +7 -7
  81. package/tasks/html/config.js +42 -42
  82. package/tasks/html/task.js +91 -91
  83. package/tasks/icons/config.js +47 -47
  84. package/tasks/icons/preprocess-config.js +60 -60
  85. package/tasks/icons/task.js +56 -56
  86. package/tasks/images/config.js +27 -27
  87. package/tasks/images/task.js +46 -46
  88. package/tasks/javascripts/config.js +69 -69
  89. package/tasks/javascripts/preprocess-config.js +109 -109
  90. package/tasks/javascripts/task.js +86 -86
  91. package/tasks/sitemap/config.js +48 -48
  92. package/tasks/sitemap/preprocess-config.js +18 -18
  93. package/tasks/sitemap/task.js +69 -69
  94. package/tasks/sizereport/config.js +23 -23
  95. package/tasks/sizereport/task.js +16 -16
  96. package/tasks/static/config.js +27 -27
  97. package/tasks/static/task.js +46 -46
  98. package/tasks/stylesheets/config.js +85 -85
  99. package/tasks/stylesheets/preprocess-config.js +41 -41
  100. package/tasks/stylesheets/task.js +73 -73
  101. package/tests/build/build.test.js +153 -153
  102. package/tests/camelize-file-name.test.js +11 -11
  103. package/tests/generate-gulp-tasks.test.js +78 -78
  104. package/tests/glob-helper.test.js +99 -99
  105. package/tests/merge.test.js +10 -10
  106. package/tests/preposition_nbsp.test.js +50 -50
  107. package/tests/run-preprocess.test.js +90 -90
  108. package/tests/sass-stringify.test.js +24 -24
  109. package/tests/sitemap.test.js +12 -12
  110. package/vendor/gulp-rolldown/index.js +151 -151
  111. package/vendor/gulp-rolldown/plugin-raw.js +17 -17
  112. package/vendor/gulp-rolldown/plugin-virtual-entry.js +30 -30
  113. package/vendor/gulp-sass/CHANGELOG.md +168 -168
  114. package/vendor/gulp-sass/LICENSE +20 -20
  115. package/vendor/gulp-sass/README.md +187 -187
  116. package/vendor/gulp-sass/index.js +208 -208
  117. package/vendor/gulp-sass/package.json +61 -61
  118. package/vendor/gulp-sass/sass-stringify.js +32 -32
  119. package/vendor/gulp-twig/LICENSE +20 -20
  120. package/vendor/gulp-twig/README.md +167 -167
  121. package/vendor/gulp-twig/index.js +138 -138
  122. package/vendor/gulp-twig/package.json +44 -44
@@ -1,31 +1,31 @@
1
- import filters from '../symfony-filters/filters.js';
2
-
3
- function applyFilter (filter) {
4
- const args = [];
5
-
6
- for (let i = 1; i < arguments.length; i++) {
7
- args.push(arguments[i]);
8
- }
9
-
10
- for (let i = 0; i < filters.length; i++) {
11
- if (filters[i].name === filter) {
12
- return filters[i].func.apply(this, args);
13
- }
14
- }
15
-
16
- return args[0];
17
- }
18
-
19
-
20
- /**
21
- * Symphony asset() TWIG function
22
- */
23
- export default [
24
- {
25
- name: 'asset',
26
- func: function (path) {
27
- const normalizedPath = (path || path === 0 ? String(path) : '');
28
- return applyFilter('version', applyFilter('cdnify', normalizedPath));
29
- }
30
- }
31
- ];
1
+ import filters from '../symfony-filters/filters.js';
2
+
3
+ function applyFilter (filter) {
4
+ const args = [];
5
+
6
+ for (let i = 1; i < arguments.length; i++) {
7
+ args.push(arguments[i]);
8
+ }
9
+
10
+ for (let i = 0; i < filters.length; i++) {
11
+ if (filters[i].name === filter) {
12
+ return filters[i].func.apply(this, args);
13
+ }
14
+ }
15
+
16
+ return args[0];
17
+ }
18
+
19
+
20
+ /**
21
+ * Symphony asset() TWIG function
22
+ */
23
+ export default [
24
+ {
25
+ name: 'asset',
26
+ func: function (path) {
27
+ const normalizedPath = (path || path === 0 ? String(path) : '');
28
+ return applyFilter('version', applyFilter('cdnify', normalizedPath));
29
+ }
30
+ }
31
+ ];
@@ -1,14 +1,14 @@
1
- import functions from './symfony-functions/functions.js';
2
-
3
- export const preprocess = {
4
- html: [
5
- function symfonyFunctionsPlugin(config) {
6
- // Add functions to TWIG configurtion
7
- config.twig = config.twig || {};
8
- config.twig.functions = config.twig.functions || [];
9
- config.twig.functions = config.twig.functions.concat(functions);
10
-
11
- return config;
12
- },
13
- ],
14
- };
1
+ import functions from './symfony-functions/functions.js';
2
+
3
+ export const preprocess = {
4
+ html: [
5
+ function symfonyFunctionsPlugin(config) {
6
+ // Add functions to TWIG configurtion
7
+ config.twig = config.twig || {};
8
+ config.twig.functions = config.twig.functions || [];
9
+ config.twig.functions = config.twig.functions.concat(functions);
10
+
11
+ return config;
12
+ },
13
+ ],
14
+ };
@@ -1,53 +1,53 @@
1
- import twig from '../../vendor/gulp-twig/index.js';
2
- import { getTaskConfig } from './../../lib/get-config.js';
3
- import { getSourcePaths } from './../../lib/get-path.js';
4
- import flattenDeep from 'lodash/flattenDeep.js';
5
- import assign from 'lodash/assign.js';
6
-
7
-
8
- /**
9
- * Modify configuration
10
- *
11
- * @param {object} config HTML configuration
12
- * @param {object} fullConfig Full configuration
13
- * @returns {object} Transformed HTML configuration
14
- */
15
- export default function preprocessHTMLConfig (config = {}, fullConfig) {
16
- if (config.twig) {
17
- config.twig.base = getSourcePaths('html');
18
-
19
- // Engine is a function which returns a gulp pipe function
20
- config.engine = function getTwigEngine () {
21
- return twig(getTaskConfig('html', 'twig'));
22
- };
23
-
24
- if (config.twig.functions) {
25
- config.twig.functions = flattenDeep(config.twig.functions);
26
- }
27
- if (config.twig.filters) {
28
- config.twig.filters = flattenDeep(config.twig.filters);
29
- }
30
- if (Array.isArray(config.twig.extend)) {
31
- const extendFnList = config.twig.extend;
32
- config.twig.extend = function (Twig) {
33
- extendFnList.forEach((fn) => fn(Twig));
34
- };
35
- }
36
-
37
- // Main 'dependents' config is shared between all tasks
38
- if (config.dependents) {
39
- for (let extension in config.dependents) {
40
- config.dependents[extension].basePaths = config.dependents[extension].basePaths || [];
41
- config.dependents[extension].basePaths = config.dependents[extension].basePaths.concat(
42
- config.twig.base
43
- );
44
- }
45
-
46
- fullConfig.dependents = assign(fullConfig.dependents || {}, config.dependents);
47
- }
48
- } else {
49
- config.twig = false;
50
- }
51
-
52
- return config;
53
- }
1
+ import twig from '../../vendor/gulp-twig/index.js';
2
+ import { getTaskConfig } from './../../lib/get-config.js';
3
+ import { getSourcePaths } from './../../lib/get-path.js';
4
+ import flattenDeep from 'lodash/flattenDeep.js';
5
+ import assign from 'lodash/assign.js';
6
+
7
+
8
+ /**
9
+ * Modify configuration
10
+ *
11
+ * @param {object} config HTML configuration
12
+ * @param {object} fullConfig Full configuration
13
+ * @returns {object} Transformed HTML configuration
14
+ */
15
+ export default function preprocessHTMLConfig (config = {}, fullConfig) {
16
+ if (config.twig) {
17
+ config.twig.base = getSourcePaths('html');
18
+
19
+ // Engine is a function which returns a gulp pipe function
20
+ config.engine = function getTwigEngine () {
21
+ return twig(getTaskConfig('html', 'twig'));
22
+ };
23
+
24
+ if (config.twig.functions) {
25
+ config.twig.functions = flattenDeep(config.twig.functions);
26
+ }
27
+ if (config.twig.filters) {
28
+ config.twig.filters = flattenDeep(config.twig.filters);
29
+ }
30
+ if (Array.isArray(config.twig.extend)) {
31
+ const extendFnList = config.twig.extend;
32
+ config.twig.extend = function (Twig) {
33
+ extendFnList.forEach((fn) => fn(Twig));
34
+ };
35
+ }
36
+
37
+ // Main 'dependents' config is shared between all tasks
38
+ if (config.dependents) {
39
+ for (let extension in config.dependents) {
40
+ config.dependents[extension].basePaths = config.dependents[extension].basePaths || [];
41
+ config.dependents[extension].basePaths = config.dependents[extension].basePaths.concat(
42
+ config.twig.base
43
+ );
44
+ }
45
+
46
+ fullConfig.dependents = assign(fullConfig.dependents || {}, config.dependents);
47
+ }
48
+ } else {
49
+ config.twig = false;
50
+ }
51
+
52
+ return config;
53
+ }
package/plugins/twig.js CHANGED
@@ -1,74 +1,74 @@
1
- import * as preprocessTwigConfig from './twig-engine/preprocess-config.js';
2
- // import * as symfonyFunctions from './twig/symfony-functions.js';
3
- // import * as symfonyFilters from './twig/symfony-filters.js';
4
- // import * as lodashFilters from './twig/lodash-filters.js';
5
-
6
- /**
7
- * TWIG plugin attaches itself to the HTML task
8
- */
9
- export const html = {
10
- // Add twig to the extensions
11
- extensions: ['twig'],
12
-
13
- // Glob list of files, which to ignore
14
- // see https://gulpjs.com/docs/en/getting-started/explaining-globs/
15
- ignore: [
16
- 'shared/**/*',
17
- 'partials/**/*',
18
- 'macros/**/*',
19
- 'embeds/**/*',
20
- 'layouts/**/*',
21
- ],
22
-
23
- // Dependents plugin for faster builds
24
- dependents: {
25
- '.twig': {
26
- parserSteps: [
27
- /\{%\s+(?:from|extends|include|embed)\s+['"]([^'"]+)/gm,
28
- ],
29
- prefixes: [],
30
- postfixes: [],
31
- basePaths: []
32
- }
33
- },
34
-
35
- twig: {
36
- // Async rendering
37
- async: true,
38
-
39
- // Disabled cache by default, it's enabled for production build only
40
- cache: false,
41
-
42
- // Rethrow TWIG error so that process exists
43
- rethrow: true,
44
-
45
- // Custom functions
46
- functions: [
47
- // symfonyFunctions,
48
- ],
49
-
50
- // Custom filters
51
- filters: [
52
- // lodashFilters,
53
- // symfonyFilters,
54
- ],
55
-
56
- // Production only settings, overwrites default settings
57
- production: {
58
- // Enable cache for improved performance during production build
59
- cache: true,
60
- },
61
- },
62
-
63
- // List of CDNs when using symphony filters / funtions
64
- cdns: [],
65
-
66
- // Add file version number when using symphony filters / funtions
67
- version: false,
68
- };
69
-
70
- export const preprocess = {
71
- html: [
72
- preprocessTwigConfig,
73
- ]
74
- };
1
+ import * as preprocessTwigConfig from './twig-engine/preprocess-config.js';
2
+ // import * as symfonyFunctions from './twig/symfony-functions.js';
3
+ // import * as symfonyFilters from './twig/symfony-filters.js';
4
+ // import * as lodashFilters from './twig/lodash-filters.js';
5
+
6
+ /**
7
+ * TWIG plugin attaches itself to the HTML task
8
+ */
9
+ export const html = {
10
+ // Add twig to the extensions
11
+ extensions: ['twig'],
12
+
13
+ // Glob list of files, which to ignore
14
+ // see https://gulpjs.com/docs/en/getting-started/explaining-globs/
15
+ ignore: [
16
+ 'shared/**/*',
17
+ 'partials/**/*',
18
+ 'macros/**/*',
19
+ 'embeds/**/*',
20
+ 'layouts/**/*',
21
+ ],
22
+
23
+ // Dependents plugin for faster builds
24
+ dependents: {
25
+ '.twig': {
26
+ parserSteps: [
27
+ /\{%\s+(?:from|extends|include|embed)\s+['"]([^'"]+)/gm,
28
+ ],
29
+ prefixes: [],
30
+ postfixes: [],
31
+ basePaths: []
32
+ }
33
+ },
34
+
35
+ twig: {
36
+ // Async rendering
37
+ async: true,
38
+
39
+ // Disabled cache by default, it's enabled for production build only
40
+ cache: false,
41
+
42
+ // Rethrow TWIG error so that process exists
43
+ rethrow: true,
44
+
45
+ // Custom functions
46
+ functions: [
47
+ // symfonyFunctions,
48
+ ],
49
+
50
+ // Custom filters
51
+ filters: [
52
+ // lodashFilters,
53
+ // symfonyFilters,
54
+ ],
55
+
56
+ // Production only settings, overwrites default settings
57
+ production: {
58
+ // Enable cache for improved performance during production build
59
+ cache: true,
60
+ },
61
+ },
62
+
63
+ // List of CDNs when using symphony filters / funtions
64
+ cdns: [],
65
+
66
+ // Add file version number when using symphony filters / funtions
67
+ version: false,
68
+ };
69
+
70
+ export const preprocess = {
71
+ html: [
72
+ preprocessTwigConfig,
73
+ ]
74
+ };
@@ -1,39 +1,39 @@
1
- import * as preprocessBrowserSyncConfig from './preprocess-config.js';
2
- import * as taskBrowserSync from './task.js';
3
-
4
- /**
5
- * Browsersync DEV server settings
6
- */
7
- export const browserSync = {
8
- // Production only settings, overwrites default settings
9
- production: false,
10
-
11
- // Development only settings, overwrites default settings
12
- // For browserSync options see https://www.browsersync.io/docs/options
13
- development: {
14
- },
15
- };
16
-
17
- export const preprocess = {
18
- browserSync: [
19
- preprocessBrowserSyncConfig,
20
- ]
21
- };
22
-
23
- export const tasks = {
24
- browserSync: [
25
- taskBrowserSync,
26
- ]
27
- };
28
-
29
-
30
- /**
31
- * Paths relative to the global src and dest folders
32
- */
33
- export const paths = {
34
- browserSync: {
35
- // Server root directory, relative to the project
36
- // If not set then global dest folder
37
- 'dest': null,
38
- }
39
- };
1
+ import * as preprocessBrowserSyncConfig from './preprocess-config.js';
2
+ import * as taskBrowserSync from './task.js';
3
+
4
+ /**
5
+ * Browsersync DEV server settings
6
+ */
7
+ export const browserSync = {
8
+ // Production only settings, overwrites default settings
9
+ production: false,
10
+
11
+ // Development only settings, overwrites default settings
12
+ // For browserSync options see https://www.browsersync.io/docs/options
13
+ development: {
14
+ },
15
+ };
16
+
17
+ export const preprocess = {
18
+ browserSync: [
19
+ preprocessBrowserSyncConfig,
20
+ ]
21
+ };
22
+
23
+ export const tasks = {
24
+ browserSync: [
25
+ taskBrowserSync,
26
+ ]
27
+ };
28
+
29
+
30
+ /**
31
+ * Paths relative to the global src and dest folders
32
+ */
33
+ export const paths = {
34
+ browserSync: {
35
+ // Server root directory, relative to the project
36
+ // If not set then global dest folder
37
+ 'dest': null,
38
+ }
39
+ };
@@ -1,32 +1,32 @@
1
- import { getProjectPath, getDestPath } from './../../lib/get-path.js';
2
- import isPlainObject from 'lodash/isPlainObject.js';
3
-
4
- /**
5
- * Modify configuration
6
- *
7
- * @param {object} config BrowserSync configuration
8
- * @param {object} fullConfig Full configuration
9
- * @returns {object} Transformed browserSync configuration
10
- */
11
- export default function preprocessBrowserSyncConfig (config = {}, fullConfig) {
12
- // If server is disabled then disable whole browserSync
13
- // If HTML is not being rendered, then browserSync has no use
14
- if (config.server === false || fullConfig.html === false) return false;
15
-
16
- if (!isPlainObject(config.server)) {
17
- config.server = {};
18
- }
19
-
20
- // Set basedir to output folder by default
21
- if (config.server) {
22
- if (config.server.baseDir) {
23
- // Relative to the project
24
- config.server.baseDir = getProjectPath(config.server.baseDir);
25
- } else {
26
- // Set to output folder from path-config.js
27
- config.server.baseDir = getDestPath('browserSync')
28
- }
29
- }
30
-
31
- return config;
32
- }
1
+ import { getProjectPath, getDestPath } from './../../lib/get-path.js';
2
+ import isPlainObject from 'lodash/isPlainObject.js';
3
+
4
+ /**
5
+ * Modify configuration
6
+ *
7
+ * @param {object} config BrowserSync configuration
8
+ * @param {object} fullConfig Full configuration
9
+ * @returns {object} Transformed browserSync configuration
10
+ */
11
+ export default function preprocessBrowserSyncConfig (config = {}, fullConfig) {
12
+ // If server is disabled then disable whole browserSync
13
+ // If HTML is not being rendered, then browserSync has no use
14
+ if (config.server === false || fullConfig.html === false) return false;
15
+
16
+ if (!isPlainObject(config.server)) {
17
+ config.server = {};
18
+ }
19
+
20
+ // Set basedir to output folder by default
21
+ if (config.server) {
22
+ if (config.server.baseDir) {
23
+ // Relative to the project
24
+ config.server.baseDir = getProjectPath(config.server.baseDir);
25
+ } else {
26
+ // Set to output folder from path-config.js
27
+ config.server.baseDir = getDestPath('browserSync')
28
+ }
29
+ }
30
+
31
+ return config;
32
+ }
@@ -1,9 +1,9 @@
1
- import bs from 'browser-sync';
2
- import { getTaskConfig } from './../../lib/get-config.js';
3
-
4
- export const watch = function browserSync(callback) {
5
- bs.init(getTaskConfig('browserSync'));
6
- };
7
-
8
- // Execute as first task
9
- watch.order = -2;
1
+ import bs from 'browser-sync';
2
+ import { getTaskConfig } from './../../lib/get-config.js';
3
+
4
+ export const watch = function browserSync(callback) {
5
+ bs.init(getTaskConfig('browserSync'));
6
+ };
7
+
8
+ // Execute as first task
9
+ watch.order = -2;
@@ -1,20 +1,20 @@
1
- import * as preprocessCleanConfig from './preprocess-config.js';
2
- import * as taskClean from './task.js';
3
-
4
- export const clean = {
5
- // Patterns, relative to the destination folder, see https://gulpjs.com/docs/en/getting-started/explaining-globs/
6
- // patterns: ['assets/**', 'temp-folder']
7
- patterns: [],
8
- };
9
-
10
- export const preprocess = {
11
- clean: [
12
- preprocessCleanConfig,
13
- ]
14
- };
15
-
16
- export const tasks = {
17
- clean: [
18
- taskClean,
19
- ]
20
- };
1
+ import * as preprocessCleanConfig from './preprocess-config.js';
2
+ import * as taskClean from './task.js';
3
+
4
+ export const clean = {
5
+ // Patterns, relative to the destination folder, see https://gulpjs.com/docs/en/getting-started/explaining-globs/
6
+ // patterns: ['assets/**', 'temp-folder']
7
+ patterns: [],
8
+ };
9
+
10
+ export const preprocess = {
11
+ clean: [
12
+ preprocessCleanConfig,
13
+ ]
14
+ };
15
+
16
+ export const tasks = {
17
+ clean: [
18
+ taskClean,
19
+ ]
20
+ };
@@ -1,19 +1,19 @@
1
- import { getDestPath } from './../../lib/get-path.js';
2
- import globs from './../../lib/globs-helper.js';
3
-
4
- /**
5
- * Modify configuration
6
- *
7
- * @param {object} config Clean configuration
8
- * @param {object} fullConfig Full configuration
9
- * @returns {object} Transformed clean configuration
10
- */
11
- export default function preprocessCleanConfig(config = {}, fullConfig) {
12
- if (!config.patterns || !config.patterns.length) {
13
- config.patterns = globs.paths(getDestPath()).generate();
14
- } else {
15
- config.patterns = globs.paths(getDestPath()).paths(config.patterns).generate();
16
- }
17
-
18
- return config;
19
- }
1
+ import { getDestPath } from './../../lib/get-path.js';
2
+ import globs from './../../lib/globs-helper.js';
3
+
4
+ /**
5
+ * Modify configuration
6
+ *
7
+ * @param {object} config Clean configuration
8
+ * @param {object} fullConfig Full configuration
9
+ * @returns {object} Transformed clean configuration
10
+ */
11
+ export default function preprocessCleanConfig(config = {}, fullConfig) {
12
+ if (!config.patterns || !config.patterns.length) {
13
+ config.patterns = globs.paths(getDestPath()).generate();
14
+ } else {
15
+ config.patterns = globs.paths(getDestPath()).paths(config.patterns).generate();
16
+ }
17
+
18
+ return config;
19
+ }
@@ -1,7 +1,7 @@
1
- import del from 'del';
2
- import { getTaskConfig } from '../../lib/get-config.js';
3
-
4
- export function beforeBuild(callback) {
5
- const patterns = getTaskConfig('clean', 'patterns');
6
- return del(patterns, { force: true });
7
- }
1
+ import del from 'del';
2
+ import { getTaskConfig } from '../../lib/get-config.js';
3
+
4
+ export function beforeBuild(callback) {
5
+ const patterns = getTaskConfig('clean', 'patterns');
6
+ return del(patterns, { force: true });
7
+ }