@videinfra/static-website-builder 2.0.10 → 2.1.0
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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [2.1.0] - 2026-03-04
|
|
8
|
+
### Changed
|
|
9
|
+
- Updated gulp-sass to use sass-embedded instead of sass
|
|
10
|
+
- Updated gulp-sass to remove legacy code and use only sync mode
|
|
11
|
+
|
|
7
12
|
## [2.0.9] - 2026-02-19
|
|
8
13
|
### Fixed
|
|
9
14
|
- Removed file extension from the sitemap URLs
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
|
|
1
3
|
.env-test:before {
|
|
2
|
-
content: map
|
|
4
|
+
content: map.get($env, host);
|
|
3
5
|
}
|
|
4
6
|
|
|
5
7
|
:root {
|
|
6
|
-
#{ --env-test-type-number }: map
|
|
7
|
-
#{ --env-test-type-empty }: map
|
|
8
|
+
#{ --env-test-type-number }: map.get($env, typeNumber);
|
|
9
|
+
#{ --env-test-type-empty }: map.get($env, typeEmpty);
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
@if map
|
|
12
|
+
@if map.get($env, typeBoolTrue) {
|
|
11
13
|
:root {
|
|
12
14
|
--env-test-bool-true: true;
|
|
13
15
|
}
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
@if map
|
|
22
|
+
@if map.get($env, typeBoolFalse) {
|
|
21
23
|
:root {
|
|
22
24
|
--env-test-bool-false: true;
|
|
23
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@videinfra/static-website-builder",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Customizable static site project builder",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"minimist": "^1.2.8",
|
|
59
59
|
"nano-memoize": "3.0.16",
|
|
60
60
|
"rolldown": "^1.0.0-rc.1",
|
|
61
|
-
"sass": "^1.97.3",
|
|
61
|
+
"sass-embedded": "^1.97.3",
|
|
62
62
|
"through": "^2.3.8",
|
|
63
63
|
"twig": "^1.17.1"
|
|
64
64
|
},
|
|
@@ -4,7 +4,7 @@ import merge from './../../lib/merge.js';
|
|
|
4
4
|
import getEnvData from './../../tasks/env/get-env.js';
|
|
5
5
|
import gulpSass from '../../vendor/gulp-sass/index.js';
|
|
6
6
|
import assign from 'lodash/assign.js';
|
|
7
|
-
import * as sass from 'sass';
|
|
7
|
+
import * as sass from 'sass-embedded';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Modify configuration
|
|
@@ -32,7 +32,15 @@ export default function processSASSConfig(config, fullConfig) {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
// Engine is a function which returns a gulp pipe function
|
|
35
|
-
config.
|
|
35
|
+
config._engineCache = null;
|
|
36
|
+
config.engine = function getSASSEngine(disposeOnly = false) {
|
|
37
|
+
if (config._engineCache) {
|
|
38
|
+
config._engineCache.dispose();
|
|
39
|
+
}
|
|
40
|
+
if (disposeOnly) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
36
44
|
const sassEngine = gulpSass(sass);
|
|
37
45
|
const sassConfig = getTaskConfig('stylesheets', 'sass');
|
|
38
46
|
|
|
@@ -41,7 +49,10 @@ export default function processSASSConfig(config, fullConfig) {
|
|
|
41
49
|
}
|
|
42
50
|
|
|
43
51
|
sassConfig.data = merge(getEnvData().sass, sassConfig.data || {});
|
|
44
|
-
|
|
52
|
+
config._engineCache = sassEngine(sassConfig).on('error', sassEngine.logError);
|
|
53
|
+
config._engineCache.dispose = sassEngine.dispose;
|
|
54
|
+
|
|
55
|
+
return config._engineCache;
|
|
45
56
|
};
|
|
46
57
|
|
|
47
58
|
// Main 'dependents' config is shared between all tasks
|
|
@@ -33,13 +33,13 @@ const getGlobPaths = nanomemoize.nanomemoize(function () {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
const getEngine = function () {
|
|
36
|
+
const getEngine = function (disposeOnly = false) {
|
|
37
37
|
const engine = getTaskConfig('stylesheets', 'engine');
|
|
38
|
-
return engine ? engine() : (() => {});
|
|
38
|
+
return engine ? engine(disposeOnly) : (() => {});
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
function
|
|
42
|
+
function stylesheetsBuild () {
|
|
43
43
|
return gulp.src(getGlobPaths())
|
|
44
44
|
.pipe(taskStart())
|
|
45
45
|
|
|
@@ -65,9 +65,14 @@ function stylesheets () {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
function stylesheetsWatch () {
|
|
68
|
-
return taskWatch(getWatchGlobPaths(true),
|
|
68
|
+
return taskWatch(getWatchGlobPaths(true), stylesheetsBuild);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function stylesheetsBuildEnd () {
|
|
72
|
+
getEngine(true);
|
|
73
|
+
return Promise.resolve();
|
|
69
74
|
}
|
|
70
75
|
|
|
71
76
|
|
|
72
|
-
export const build =
|
|
77
|
+
export const build = gulp.series(stylesheetsBuild, stylesheetsBuildEnd);
|
|
73
78
|
export const watch = stylesheetsWatch;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// 2025-01-20, Kaspars Zuks: added "options.data" support for variables
|
|
2
|
+
// 2026-03-04, Kaspars Zuks: updated to use "compileString" instead of "renderSync"
|
|
3
|
+
// 2026-03-04, Kaspars Zuks: removed async version
|
|
2
4
|
'use strict';
|
|
3
5
|
|
|
4
6
|
import path from 'path';
|
|
@@ -8,54 +10,17 @@ import PluginError from 'plugin-error';
|
|
|
8
10
|
import replaceExtension from 'replace-ext';
|
|
9
11
|
import stripAnsi from 'strip-ansi';
|
|
10
12
|
import clonedeep from 'lodash.clonedeep';
|
|
11
|
-
import applySourceMap from 'vinyl-sourcemaps-apply';
|
|
12
13
|
import sassStingify from './sass-stringify.js';
|
|
13
14
|
|
|
14
15
|
const PLUGIN_NAME = 'gulp-sass';
|
|
15
16
|
|
|
16
|
-
const MISSING_COMPILER_MESSAGE = `
|
|
17
|
-
gulp-sass no longer has a default Sass compiler; please set one yourself.
|
|
18
|
-
Both the "sass" and "node-sass" packages are permitted.
|
|
19
|
-
For example, in your gulpfile:
|
|
20
|
-
|
|
21
|
-
import * as sass from 'sass';
|
|
22
|
-
import gulpSass from 'gulp-sass';
|
|
23
|
-
const instance = gulpSass(sass);
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
17
|
const transfob = (transform) => new Transform({ transform, objectMode: true });
|
|
27
18
|
|
|
28
19
|
/**
|
|
29
20
|
* Handles returning the file to the stream
|
|
30
21
|
*/
|
|
31
|
-
const filePush = (file,
|
|
32
|
-
|
|
33
|
-
if (sassObject.map) {
|
|
34
|
-
// Transform map into JSON
|
|
35
|
-
const sassMap = JSON.parse(sassObject.map.toString());
|
|
36
|
-
// Grab the stdout and transform it into stdin
|
|
37
|
-
const sassMapFile = sassMap.file.replace(/^stdout$/, 'stdin');
|
|
38
|
-
// Grab the base filename that's being worked on
|
|
39
|
-
const sassFileSrc = file.relative;
|
|
40
|
-
// Grab the path portion of the file that's being worked on
|
|
41
|
-
const sassFileSrcPath = path.dirname(sassFileSrc);
|
|
42
|
-
|
|
43
|
-
if (sassFileSrcPath) {
|
|
44
|
-
const sourceFileIndex = sassMap.sources.indexOf(sassMapFile);
|
|
45
|
-
// Prepend the path to all files in the sources array except the file that's being worked on
|
|
46
|
-
sassMap.sources = sassMap.sources.map((source, index) => (index === sourceFileIndex ? source : path.join(sassFileSrcPath, source)));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Remove 'stdin' from souces and replace with filenames!
|
|
50
|
-
sassMap.sources = sassMap.sources.filter((src) => src !== 'stdin' && src);
|
|
51
|
-
|
|
52
|
-
// Replace the map file with the original filename (but new extension)
|
|
53
|
-
sassMap.file = replaceExtension(sassFileSrc, '.css');
|
|
54
|
-
// Apply the map
|
|
55
|
-
applySourceMap(file, sassMap);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
file.contents = sassObject.css;
|
|
22
|
+
const filePush = (file, css, callback) => {
|
|
23
|
+
file.contents = css;
|
|
59
24
|
file.path = replaceExtension(file.path, '.css');
|
|
60
25
|
|
|
61
26
|
if (file.stat) {
|
|
@@ -81,32 +46,13 @@ const handleError = (error, file, callback) => {
|
|
|
81
46
|
return callback(new PluginError(PLUGIN_NAME, error));
|
|
82
47
|
};
|
|
83
48
|
|
|
84
|
-
/**
|
|
85
|
-
* Escape SCSS variable value for output in SCSS
|
|
86
|
-
* @param {any} value Value
|
|
87
|
-
* @returns {string} Escaped value
|
|
88
|
-
*/
|
|
89
|
-
const escapeSCSSVariable = (value) => {
|
|
90
|
-
if (value !== '' && (value === true || value === false || !isNaN(value))) {
|
|
91
|
-
return String(value);
|
|
92
|
-
} else {
|
|
93
|
-
// Convert to string
|
|
94
|
-
return "'" + value.toString().replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/\n/g, '\\n') + "'";
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
49
|
/**
|
|
99
50
|
* Main Gulp Sass function
|
|
100
51
|
*/
|
|
101
52
|
|
|
102
53
|
// eslint-disable-next-line arrow-body-style
|
|
103
|
-
const gulpSass = (options
|
|
54
|
+
const gulpSass = (options) => {
|
|
104
55
|
return transfob((file, encoding, callback) => {
|
|
105
|
-
if (file.isNull()) {
|
|
106
|
-
callback(null, file);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
56
|
if (file.isStream()) {
|
|
111
57
|
callback(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
|
|
112
58
|
return;
|
|
@@ -117,23 +63,21 @@ const gulpSass = (options, sync) => {
|
|
|
117
63
|
return;
|
|
118
64
|
}
|
|
119
65
|
|
|
120
|
-
if (!file.contents.length) {
|
|
66
|
+
if (file.contents && !file.contents.length) {
|
|
121
67
|
file.path = replaceExtension(file.path, '.css');
|
|
122
68
|
callback(null, file);
|
|
123
69
|
return;
|
|
124
70
|
}
|
|
125
71
|
|
|
126
72
|
const opts = clonedeep(options || {});
|
|
127
|
-
|
|
73
|
+
let source = file.contents.toString();
|
|
128
74
|
|
|
129
75
|
// Stringiyfy variables
|
|
130
|
-
if (
|
|
131
|
-
|
|
76
|
+
if (opts.data) {
|
|
77
|
+
source = sassStingify(opts.data) + source;
|
|
78
|
+
delete(opts.data);
|
|
132
79
|
}
|
|
133
80
|
|
|
134
|
-
// We set the file path here so that libsass can correctly resolve import paths
|
|
135
|
-
opts.file = file.path;
|
|
136
|
-
|
|
137
81
|
// Ensure `indentedSyntax` is true if a `.sass` file
|
|
138
82
|
if (path.extname(file.path) === '.sass') {
|
|
139
83
|
opts.indentedSyntax = true;
|
|
@@ -150,59 +94,35 @@ const gulpSass = (options, sync) => {
|
|
|
150
94
|
|
|
151
95
|
opts.includePaths.unshift(path.dirname(file.path));
|
|
152
96
|
|
|
153
|
-
//
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
opts.omitSourceMapUrl = true;
|
|
157
|
-
opts.sourceMapContents = true;
|
|
158
|
-
}
|
|
97
|
+
// Rename `includePaths` to `loadPaths`
|
|
98
|
+
opts.loadPaths = opts.includePaths;
|
|
99
|
+
delete(opts.includePaths);
|
|
159
100
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (error) {
|
|
166
|
-
handleError(error, file, callback);
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
filePush(file, obj, callback);
|
|
171
|
-
});
|
|
172
|
-
} else {
|
|
173
|
-
/**
|
|
174
|
-
* Sync Sass render
|
|
175
|
-
*/
|
|
176
|
-
try {
|
|
177
|
-
filePush(file, gulpSass.compiler.renderSync(opts), callback);
|
|
178
|
-
} catch (error) {
|
|
179
|
-
handleError(error, file, callback);
|
|
180
|
-
}
|
|
101
|
+
try {
|
|
102
|
+
const result = gulpSass.compiler.compileString(source, opts);
|
|
103
|
+
filePush(file, Buffer.from(result.css, 'utf8'), callback);
|
|
104
|
+
} catch (error) {
|
|
105
|
+
handleError(error, file, callback);
|
|
181
106
|
}
|
|
182
107
|
});
|
|
183
108
|
};
|
|
184
109
|
|
|
185
|
-
/**
|
|
186
|
-
* Sync Sass render
|
|
187
|
-
*/
|
|
188
|
-
gulpSass.sync = (options) => gulpSass(options, true);
|
|
189
|
-
|
|
190
110
|
/**
|
|
191
111
|
* Log errors nicely
|
|
192
112
|
*/
|
|
193
113
|
gulpSass.logError = function logError(error) {
|
|
194
|
-
const message = new PluginError('sass', error.messageFormatted).toString();
|
|
114
|
+
const message = new PluginError('sass', error.messageFormatted || error.message).toString();
|
|
195
115
|
process.stderr.write(`${message}\n`);
|
|
196
116
|
this.emit('end');
|
|
197
117
|
};
|
|
198
118
|
|
|
199
|
-
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
process.stderr.write(`${message}\n`);
|
|
203
|
-
process.exit(1);
|
|
119
|
+
gulpSass.dispose = function () {
|
|
120
|
+
if (gulpSass.compiler.dispose) {
|
|
121
|
+
gulpSass.compiler.dispose();
|
|
204
122
|
}
|
|
123
|
+
}
|
|
205
124
|
|
|
206
|
-
|
|
125
|
+
export default (compiler) => {
|
|
126
|
+
gulpSass.compiler = compiler.initCompiler();
|
|
207
127
|
return gulpSass;
|
|
208
128
|
};
|