@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
package/package.json CHANGED
@@ -1,68 +1,68 @@
1
- {
2
- "name": "@videinfra/static-website-builder",
3
- "version": "2.0.2",
4
- "description": "Customizable static site project builder",
5
- "license": "MIT",
6
- "engines": {
7
- "node": ">=20.0.0"
8
- },
9
- "bugs": {
10
- "url": "https://github.com/videinfra/static-website-builder/issues"
11
- },
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/videinfra/static-website-builder.git"
15
- },
16
- "bin": {
17
- "builder": "bin/builder.js"
18
- },
19
- "main": "gulpfile.js/index.js",
20
- "author": "Vide Infra",
21
- "type": "module",
22
- "scripts": {
23
- "start": "cross-env BUILDER_MODE=development gulp watch",
24
- "build": "cross-env BUILDER_MODE=production gulp build",
25
- "test": "gulp build --silent --config=init/test/config/config.js && node --experimental-vm-modules node_modules/jest/bin/jest.js",
26
- "test-watch": "gulp watch --config=init/test/config/config.js",
27
- "test-builder": "node bin/builder.js build --config=init/test/config/config.js"
28
- },
29
- "dependencies": {
30
- "@csstools/postcss-nested-calc": "^5.0.0",
31
- "@rollup/plugin-replace": "^6.0.3",
32
- "autoprefixer": "^10.4.23",
33
- "browser-sync": "^3.0.4",
34
- "chalk": "4.1.2",
35
- "chokidar": "^5.0.0",
36
- "cross-env": "^10.1.0",
37
- "cssnano": "^7.1.2",
38
- "del": "^6.0.0",
39
- "dotenv": "^17.2.3",
40
- "gulp": "^5.0.1",
41
- "gulp-cached": "^1.1.1",
42
- "gulp-data": "^1.3.1",
43
- "gulp-dependents": "^1.2.5",
44
- "gulp-htmlmin": "^5.0.1",
45
- "gulp-if": "^3.0.0",
46
- "gulp-ignore": "^3.0.0",
47
- "gulp-plumber": "^1.2.1",
48
- "gulp-postcss": "^10.0.0",
49
- "gulp-sass": "^5.1.0",
50
- "gulp-sitemap": "^8.0.0",
51
- "gulp-sizereport": "^1.2.1",
52
- "gulp-sourcemaps": "^2.6.5",
53
- "gulp-svgmin": "^4.1.0",
54
- "gulp-svgstore": "^9.0.0",
55
- "lodash.clone": "^4.3.2",
56
- "lodash.some": "^4.2.2",
57
- "map-stream": "^0.1.0",
58
- "minimist": "^1.2.8",
59
- "nano-memoize": "3.0.16",
60
- "rolldown": "^1.0.0-rc.1",
61
- "sass": "^1.97.3",
62
- "through": "^2.3.8",
63
- "twig": "^1.17.1"
64
- },
65
- "devDependencies": {
66
- "jest": "^30.2.0"
67
- }
68
- }
1
+ {
2
+ "name": "@videinfra/static-website-builder",
3
+ "version": "2.0.4",
4
+ "description": "Customizable static site project builder",
5
+ "license": "MIT",
6
+ "engines": {
7
+ "node": ">=20.0.0"
8
+ },
9
+ "bugs": {
10
+ "url": "https://github.com/videinfra/static-website-builder/issues"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/videinfra/static-website-builder.git"
15
+ },
16
+ "bin": {
17
+ "builder": "bin/builder.js"
18
+ },
19
+ "main": "gulpfile.js/index.js",
20
+ "author": "Vide Infra",
21
+ "type": "module",
22
+ "scripts": {
23
+ "start": "cross-env BUILDER_MODE=development gulp watch",
24
+ "build": "cross-env BUILDER_MODE=production gulp build",
25
+ "test": "gulp build --silent --config=init/test/config/config.js && node --disable-warning=ExperimentalWarning --experimental-vm-modules node_modules/jest/bin/jest.js",
26
+ "test-watch": "gulp watch --config=init/test/config/config.js",
27
+ "test-builder": "node bin/builder.js build --config=init/test/config/config.js"
28
+ },
29
+ "dependencies": {
30
+ "@csstools/postcss-nested-calc": "^5.0.0",
31
+ "@rollup/plugin-replace": "^6.0.3",
32
+ "autoprefixer": "^10.4.23",
33
+ "browser-sync": "^3.0.4",
34
+ "chalk": "4.1.2",
35
+ "chokidar": "^5.0.0",
36
+ "cross-env": "^10.1.0",
37
+ "cssnano": "^7.1.2",
38
+ "del": "^6.0.0",
39
+ "dotenv": "^17.2.3",
40
+ "gulp": "^5.0.1",
41
+ "gulp-cached": "^1.1.1",
42
+ "gulp-data": "^1.3.1",
43
+ "gulp-dependents": "^1.2.5",
44
+ "gulp-htmlmin": "^5.0.1",
45
+ "gulp-if": "^3.0.0",
46
+ "gulp-ignore": "^3.0.0",
47
+ "gulp-plumber": "^1.2.1",
48
+ "gulp-postcss": "^10.0.0",
49
+ "gulp-sass": "^5.1.0",
50
+ "gulp-sitemap": "^8.0.0",
51
+ "gulp-sizereport": "^1.2.1",
52
+ "gulp-sourcemaps": "^2.6.5",
53
+ "gulp-svgmin": "^4.1.0",
54
+ "gulp-svgstore": "^9.0.0",
55
+ "lodash.clone": "^4.3.2",
56
+ "lodash.some": "^4.2.2",
57
+ "map-stream": "^0.1.0",
58
+ "minimist": "^1.2.8",
59
+ "nano-memoize": "3.0.16",
60
+ "rolldown": "^1.0.0-rc.1",
61
+ "sass": "^1.97.3",
62
+ "through": "^2.3.8",
63
+ "twig": "^1.17.1"
64
+ },
65
+ "devDependencies": {
66
+ "jest": "^30.2.0"
67
+ }
68
+ }
@@ -1,17 +1,17 @@
1
- /**
2
- * Modify configuration
3
- *
4
- * @param {object} config Example configuration
5
- * @param {object} fullConfig Full configuration
6
- * @returns {object} Transformed example configuration
7
- */
8
- export default function preprocessExampleConfig (config = {}, fullConfig) {
9
- // Do something with config, eg. add files starting with underscore to the ignore list.
10
- // Ignore will be a list of globs, relative to the example source path, see task.js
11
- config.ignore = config.ignore.concat([
12
- '_*',
13
- '**/_*'
14
- ]);
15
-
16
- return config;
17
- }
1
+ /**
2
+ * Modify configuration
3
+ *
4
+ * @param {object} config Example configuration
5
+ * @param {object} fullConfig Full configuration
6
+ * @returns {object} Transformed example configuration
7
+ */
8
+ export default function preprocessExampleConfig (config = {}, fullConfig) {
9
+ // Do something with config, eg. add files starting with underscore to the ignore list.
10
+ // Ignore will be a list of globs, relative to the example source path, see task.js
11
+ config.ignore = config.ignore.concat([
12
+ '_*',
13
+ '**/_*'
14
+ ]);
15
+
16
+ return config;
17
+ }
@@ -1,55 +1,55 @@
1
- import gulp from 'gulp';
2
- import { nanomemoize } from 'nano-memoize';
3
-
4
- import globs from '@videinfra/example-website-builder/lib/globs-helper.js';
5
- import { getTaskConfig } from '@videinfra/example-website-builder/lib/get-config.js';
6
- import getPaths from '@videinfra/example-website-builder/lib/get-path.js';
7
-
8
- import taskStart from '@videinfra/example-website-builder/lib/gulp/task-start.js';
9
- import taskEnd from '@videinfra/example-website-builder/lib/gulp/task-end.js';
10
- import taskWatch from '@videinfra/example-website-builder/lib/gulp/task-watch.js';
11
-
12
-
13
- // Paths and files which gulp will watch and run on
14
- // Using memoize to cache the result, for performance
15
- const getWatchGlobPaths = function (forChokidar = false) {
16
- const sourcePaths = getPaths.getSourcePaths('example');
17
- const extensions = getTaskConfig('example', 'extensions');
18
- const ignore = getTaskConfig('example', 'ignore');
19
-
20
- // Combine source paths and extensions
21
- return globs.generate(
22
- globs.paths(sourcePaths).filesWithExtensions(extensions), // Files to watch
23
- globs.paths(sourcePaths).paths(ignore).ignore(), // Exclude files and folders from being processed
24
- );
25
- };
26
- const getGlobPaths = nanomemoize.nanomemoize(function () {
27
- return getWatchGlobPaths(false);
28
- });
29
-
30
-
31
- function example () {
32
- return gulp.src(getGlobPaths(), { since: gulp.lastRun(example) })
33
- // Start of task, handles errors
34
- .pipe(taskStart())
35
-
36
- // Do something....
37
-
38
- // Output into destination folder for 'example'
39
- .pipe(taskBeforeDest())
40
- .pipe(gulp.dest(getPaths.getDestPath('example')))
41
-
42
- // End task, handles reloading on file change
43
- .pipe(taskEnd());
44
- }
45
-
46
- function exampleWatch () {
47
- return taskWatch(getWatchGlobPaths(true), example);
48
- }
49
-
50
-
51
- // Available tasks are: beforeWatch, watch, beforeBuild, build, afterBuild
52
- // Execution order for development is: beforeBuild -> build-> beforeWatch -> watch
53
- // Execution order for production is: beforeBuild -> build-> afterBuild
54
- export const build = example;
55
- export const watch = exampleWatch;
1
+ import gulp from 'gulp';
2
+ import { nanomemoize } from 'nano-memoize';
3
+
4
+ import globs from '@videinfra/example-website-builder/lib/globs-helper.js';
5
+ import { getTaskConfig } from '@videinfra/example-website-builder/lib/get-config.js';
6
+ import getPaths from '@videinfra/example-website-builder/lib/get-path.js';
7
+
8
+ import taskStart from '@videinfra/example-website-builder/lib/gulp/task-start.js';
9
+ import taskEnd from '@videinfra/example-website-builder/lib/gulp/task-end.js';
10
+ import taskWatch from '@videinfra/example-website-builder/lib/gulp/task-watch.js';
11
+
12
+
13
+ // Paths and files which gulp will watch and run on
14
+ // Using memoize to cache the result, for performance
15
+ const getWatchGlobPaths = function (forChokidar = false) {
16
+ const sourcePaths = getPaths.getSourcePaths('example');
17
+ const extensions = getTaskConfig('example', 'extensions');
18
+ const ignore = getTaskConfig('example', 'ignore');
19
+
20
+ // Combine source paths and extensions
21
+ return globs.generate(
22
+ globs.paths(sourcePaths).filesWithExtensions(extensions), // Files to watch
23
+ globs.paths(sourcePaths).paths(ignore).ignore(), // Exclude files and folders from being processed
24
+ );
25
+ };
26
+ const getGlobPaths = nanomemoize.nanomemoize(function () {
27
+ return getWatchGlobPaths(false);
28
+ });
29
+
30
+
31
+ function example () {
32
+ return gulp.src(getGlobPaths(), { since: gulp.lastRun(example) })
33
+ // Start of task, handles errors
34
+ .pipe(taskStart())
35
+
36
+ // Do something....
37
+
38
+ // Output into destination folder for 'example'
39
+ .pipe(taskBeforeDest())
40
+ .pipe(gulp.dest(getPaths.getDestPath('example')))
41
+
42
+ // End task, handles reloading on file change
43
+ .pipe(taskEnd());
44
+ }
45
+
46
+ function exampleWatch () {
47
+ return taskWatch(getWatchGlobPaths(true), example);
48
+ }
49
+
50
+
51
+ // Available tasks are: beforeWatch, watch, beforeBuild, build, afterBuild
52
+ // Execution order for development is: beforeBuild -> build-> beforeWatch -> watch
53
+ // Execution order for production is: beforeBuild -> build-> afterBuild
54
+ export const build = example;
55
+ export const watch = exampleWatch;
@@ -1,38 +1,38 @@
1
- /**
2
- * Configuration for the example plugin
3
- */
4
- import * as examplePreprocessConfig from './example/preprocess-config.js';
5
- import * as exampleTask from './example/task.js';
6
-
7
- export const example = {
8
- // Glob list of files, which to ignore
9
- // see https://gulpjs.com/docs/en/getting-started/explaining-globs/
10
- ignore: [],
11
-
12
- // Filename extensions
13
- extensions: ['example'],
14
- };
15
-
16
- // Function which can validate and modify configuration
17
- export const preprocess = {
18
- example: [
19
- examplePreprocessConfig,
20
- ]
21
- };
22
-
23
- // Gulp task
24
- export const tasks = {
25
- example: [
26
- exampleTask,
27
- ]
28
- };
29
-
30
- /**
31
- * Paths relative to the global src and dest folders
32
- */
33
- export const paths = {
34
- example: {
35
- 'src': 'example',
36
- 'dest': 'assets/example',
37
- }
38
- };
1
+ /**
2
+ * Configuration for the example plugin
3
+ */
4
+ import * as examplePreprocessConfig from './example/preprocess-config.js';
5
+ import * as exampleTask from './example/task.js';
6
+
7
+ export const example = {
8
+ // Glob list of files, which to ignore
9
+ // see https://gulpjs.com/docs/en/getting-started/explaining-globs/
10
+ ignore: [],
11
+
12
+ // Filename extensions
13
+ extensions: ['example'],
14
+ };
15
+
16
+ // Function which can validate and modify configuration
17
+ export const preprocess = {
18
+ example: [
19
+ examplePreprocessConfig,
20
+ ]
21
+ };
22
+
23
+ // Gulp task
24
+ export const tasks = {
25
+ example: [
26
+ exampleTask,
27
+ ]
28
+ };
29
+
30
+ /**
31
+ * Paths relative to the global src and dest folders
32
+ */
33
+ export const paths = {
34
+ example: {
35
+ 'src': 'example',
36
+ 'dest': 'assets/example',
37
+ }
38
+ };
@@ -1,59 +1,59 @@
1
- import { getSourcePaths, getProjectPath } from './../../lib/get-path.js';
2
- import { getTaskConfig } from './../../lib/get-config.js';
3
- import merge from './../../lib/merge.js';
4
- import getEnvData from './../../tasks/env/get-env.js';
5
- import gulpSass from '../../vendor/gulp-sass/index.js';
6
- import assign from 'lodash/assign.js';
7
- import * as sass from 'sass';
8
-
9
- /**
10
- * Modify configuration
11
- *
12
- * @param {object} config Stylesheet configuration
13
- * @param {object} fullConfig Full configuration
14
- * @returns {object} Transformed stylesheet configuration
15
- */
16
- export default function processSASSConfig(config, fullConfig) {
17
- if (config && config.sass) {
18
- if (config.sass.includePaths) {
19
- // Map include paths to the project folder
20
- config.sass.includePaths = config.sass.includePaths.map((path) => getProjectPath(path));
21
- } else {
22
- config.sass.includePaths = [];
23
- }
24
-
25
- // Add stylesheet source path
26
- const stylesheetSourcePath = getSourcePaths('stylesheets');
27
-
28
- stylesheetSourcePath.forEach((path) => {
29
- if (!config.sass.includePaths.includes(path)) {
30
- config.sass.includePaths.push(path);
31
- }
32
- });
33
-
34
- // Engine is a function which returns a gulp pipe function
35
- config.engine = function getSASSEngine() {
36
- const sassEngine = gulpSass(sass);
37
- const sassConfig = getTaskConfig('stylesheets', 'sass');
38
-
39
- if (config.legacy) {
40
- sassConfig.silenceDeprecations = (sassConfig.silenceDeprecations || []).concat(['import', 'global-builtin', 'slash-div', 'color-functions']);
41
- }
42
-
43
- sassConfig.data = merge(getEnvData().sass, sassConfig.data || {});
44
- return sassEngine(sassConfig, /* sync */ true).on('error', sassEngine.logError);
45
- };
46
-
47
- // Main 'dependents' config is shared between all tasks
48
- if (config.dependents) {
49
- for (let extension in config.dependents) {
50
- config.dependents[extension].basePaths = config.dependents[extension].basePaths || [];
51
- config.dependents[extension].basePaths = config.dependents[extension].basePaths.concat(getSourcePaths('stylesheets'));
52
- }
53
-
54
- fullConfig.dependents = assign(fullConfig.dependents || {}, config.dependents);
55
- }
56
- }
57
-
58
- return config;
59
- }
1
+ import { getSourcePaths, getProjectPath } from './../../lib/get-path.js';
2
+ import { getTaskConfig } from './../../lib/get-config.js';
3
+ import merge from './../../lib/merge.js';
4
+ import getEnvData from './../../tasks/env/get-env.js';
5
+ import gulpSass from '../../vendor/gulp-sass/index.js';
6
+ import assign from 'lodash/assign.js';
7
+ import * as sass from 'sass';
8
+
9
+ /**
10
+ * Modify configuration
11
+ *
12
+ * @param {object} config Stylesheet configuration
13
+ * @param {object} fullConfig Full configuration
14
+ * @returns {object} Transformed stylesheet configuration
15
+ */
16
+ export default function processSASSConfig(config, fullConfig) {
17
+ if (config && config.sass) {
18
+ if (config.sass.includePaths) {
19
+ // Map include paths to the project folder
20
+ config.sass.includePaths = config.sass.includePaths.map((path) => getProjectPath(path));
21
+ } else {
22
+ config.sass.includePaths = [];
23
+ }
24
+
25
+ // Add stylesheet source path
26
+ const stylesheetSourcePath = getSourcePaths('stylesheets');
27
+
28
+ stylesheetSourcePath.forEach((path) => {
29
+ if (!config.sass.includePaths.includes(path)) {
30
+ config.sass.includePaths.push(path);
31
+ }
32
+ });
33
+
34
+ // Engine is a function which returns a gulp pipe function
35
+ config.engine = function getSASSEngine() {
36
+ const sassEngine = gulpSass(sass);
37
+ const sassConfig = getTaskConfig('stylesheets', 'sass');
38
+
39
+ if (config.legacy) {
40
+ sassConfig.silenceDeprecations = (sassConfig.silenceDeprecations || []).concat(['import', 'global-builtin', 'slash-div', 'color-functions']);
41
+ }
42
+
43
+ sassConfig.data = merge(getEnvData().sass, sassConfig.data || {});
44
+ return sassEngine(sassConfig, /* sync */ true).on('error', sassEngine.logError);
45
+ };
46
+
47
+ // Main 'dependents' config is shared between all tasks
48
+ if (config.dependents) {
49
+ for (let extension in config.dependents) {
50
+ config.dependents[extension].basePaths = config.dependents[extension].basePaths || [];
51
+ config.dependents[extension].basePaths = config.dependents[extension].basePaths.concat(getSourcePaths('stylesheets'));
52
+ }
53
+
54
+ fullConfig.dependents = assign(fullConfig.dependents || {}, config.dependents);
55
+ }
56
+ }
57
+
58
+ return config;
59
+ }
package/plugins/sass.js CHANGED
@@ -1,41 +1,41 @@
1
- import * as preprocessSassConfig from './sass-engine/preprocess-config.js';
2
-
3
- /**
4
- * SASS plugin attaches itself to the stylesheets task
5
- */
6
- export const stylesheets = {
7
- // Add sass to the extensions
8
- extensions: ['scss', 'sass'],
9
-
10
- // Silence deprecations for `sass`
11
- legacy: true,
12
-
13
- // SASS options
14
- // see https://sass-lang.com/documentation/js-api/interfaces/options/
15
- sass: {
16
- includePaths: ['./node_modules'],
17
- silenceDeprecations: ['legacy-js-api'],
18
- },
19
-
20
- // Dependents plugin for faster builds
21
- dependents: {
22
- '.scss': {
23
- parserSteps:
24
- [
25
- // The language semantics allow import statements with a comma-separated list of file paths.
26
- // Therefore, we first extract the whole statement, and then extract each of the paths from that.
27
- /(?:^|;|{|}|\*\/)\s*@(import|use|forward)\s+((?:"[^"]+"|'[^']+'|url\((?:"[^"]+"|'[^']+'|[^)]+)\))(?:\s*,\s*(?:"[^"]+"|'[^']+'|url\((?:"[^"]+"|'[^']+'|[^)]+)\)))*)(?=[^;]*;)/gm,
28
- /"([^"]+)"|'([^']+)'|url\((?:"([^"]+)"|'([^']+)'|([^)]+))\)/gm
29
- ],
30
- prefixes: ['', '_'],
31
- postfixes: ['.scss', '.sass'],
32
- basePaths: []
33
- },
34
- },
35
- };
36
-
37
- export const preprocess = {
38
- stylesheets: [
39
- preprocessSassConfig,
40
- ]
41
- };
1
+ import * as preprocessSassConfig from './sass-engine/preprocess-config.js';
2
+
3
+ /**
4
+ * SASS plugin attaches itself to the stylesheets task
5
+ */
6
+ export const stylesheets = {
7
+ // Add sass to the extensions
8
+ extensions: ['scss', 'sass'],
9
+
10
+ // Silence deprecations for `sass`
11
+ legacy: true,
12
+
13
+ // SASS options
14
+ // see https://sass-lang.com/documentation/js-api/interfaces/options/
15
+ sass: {
16
+ includePaths: ['./node_modules'],
17
+ silenceDeprecations: ['legacy-js-api'],
18
+ },
19
+
20
+ // Dependents plugin for faster builds
21
+ dependents: {
22
+ '.scss': {
23
+ parserSteps:
24
+ [
25
+ // The language semantics allow import statements with a comma-separated list of file paths.
26
+ // Therefore, we first extract the whole statement, and then extract each of the paths from that.
27
+ /(?:^|;|{|}|\*\/)\s*@(import|use|forward)\s+((?:"[^"]+"|'[^']+'|url\((?:"[^"]+"|'[^']+'|[^)]+)\))(?:\s*,\s*(?:"[^"]+"|'[^']+'|url\((?:"[^"]+"|'[^']+'|[^)]+)\)))*)(?=[^;]*;)/gm,
28
+ /"([^"]+)"|'([^']+)'|url\((?:"([^"]+)"|'([^']+)'|([^)]+))\)/gm
29
+ ],
30
+ prefixes: ['', '_'],
31
+ postfixes: ['.scss', '.sass'],
32
+ basePaths: []
33
+ },
34
+ },
35
+ };
36
+
37
+ export const preprocess = {
38
+ stylesheets: [
39
+ preprocessSassConfig,
40
+ ]
41
+ };