@videinfra/static-website-builder 1.15.10 → 1.16.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,13 @@ 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
|
+
## [1.16.0] - 2025-10-22
|
|
8
|
+
### Updated
|
|
9
|
+
- Removed `node-sass` and use `sass` module
|
|
10
|
+
|
|
11
|
+
## [1.15.11] - 2025-10-08
|
|
12
|
+
- Updated "preposition_nbsp" TWIG filter
|
|
13
|
+
|
|
7
14
|
## [1.15.10] - 2025-09-26
|
|
8
15
|
- Updated "preposition_nbsp" TWIG filter
|
|
9
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@videinfra/static-website-builder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "Customizable static site project builder",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -58,8 +58,7 @@
|
|
|
58
58
|
"map-stream": "^0.1.0",
|
|
59
59
|
"minimist": "^1.2.8",
|
|
60
60
|
"nano-memoize": "1.3.0",
|
|
61
|
-
"
|
|
62
|
-
"sass": "^1.65.1",
|
|
61
|
+
"sass": "^1.93.2",
|
|
63
62
|
"through": "^2.3.8",
|
|
64
63
|
"twig": "^1.10.5",
|
|
65
64
|
"webpack": "^4.46.0",
|
|
@@ -34,9 +34,13 @@ module.exports = function processSASSConfig (config, fullConfig) {
|
|
|
34
34
|
|
|
35
35
|
// Engine is a function which returns a gulp pipe function
|
|
36
36
|
config.engine = function getSASSEngine () {
|
|
37
|
-
const sass =
|
|
37
|
+
const sass = gulpSass(require('sass'));
|
|
38
38
|
const sassConfig = getConfig.getTaskConfig('stylesheets', 'sass');
|
|
39
39
|
|
|
40
|
+
if (config.legacy) {
|
|
41
|
+
sassConfig.silenceDeprecations = (sassConfig.silenceDeprecations || []).concat(['import', 'global-builtin', 'slash-div']);
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
sassConfig.data = merge(getEnvData().sass, sassConfig.data || {});
|
|
41
45
|
return sass(sassConfig).on('error', sass.logError)
|
|
42
46
|
};
|
package/plugins/sass.js
CHANGED
|
@@ -5,13 +5,14 @@ exports.stylesheets = {
|
|
|
5
5
|
// Add sass to the extensions
|
|
6
6
|
extensions: ['scss', 'sass'],
|
|
7
7
|
|
|
8
|
-
//
|
|
8
|
+
// Silence deprecations for `sass`
|
|
9
9
|
legacy: true,
|
|
10
10
|
|
|
11
11
|
// SASS options
|
|
12
|
-
// see https://
|
|
12
|
+
// see https://sass-lang.com/documentation/js-api/interfaces/options/
|
|
13
13
|
sass: {
|
|
14
14
|
includePaths: ['./node_modules'],
|
|
15
|
+
silenceDeprecations: ['legacy-js-api'],
|
|
15
16
|
},
|
|
16
17
|
|
|
17
18
|
// Dependents plugin for faster builds
|
|
@@ -10,6 +10,7 @@ const prepositions = [
|
|
|
10
10
|
// [^\\p{L}] # Non-letter, works with unicode characters too
|
|
11
11
|
const regexWordBoundary = '(?<=(^|[^\\p{L}]))';
|
|
12
12
|
const regexEscape = /[.*+?^${}()|[\]\\]/g;
|
|
13
|
+
const regexSplitTags = /<[^>]+>/ug;
|
|
13
14
|
|
|
14
15
|
const regexMdash = /\s+—/uig;
|
|
15
16
|
const regexNdash = /\s+–/uig;
|
|
@@ -31,27 +32,46 @@ function escapeRegExp(string) {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
function prepositionNbsp(text) {
|
|
35
|
+
if (!text) {
|
|
36
|
+
return '';
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
if (!prepositionsRegex) {
|
|
35
40
|
const prepositionsEscaped = prepositions.map(preposition => escapeRegExp(preposition));
|
|
36
41
|
prepositionsRegex = new RegExp(`${regexWordBoundary}(${prepositionsEscaped.join('|')})\\s+`, 'uig');
|
|
37
42
|
}
|
|
38
43
|
|
|
39
|
-
text
|
|
44
|
+
// Split text into regular text and HTML tags
|
|
45
|
+
const textTags = text.match(regexSplitTags) || [];
|
|
46
|
+
const textNoTags = text.split(regexSplitTags);
|
|
47
|
+
|
|
48
|
+
// Replace prepositions in regular text
|
|
49
|
+
for (let i = 0; i < textNoTags.length; i++) {
|
|
50
|
+
let textPart = textNoTags[i];
|
|
40
51
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
text = text.replace(regexHyphen, ' -', text);
|
|
44
|
-
text = text.replace(regexHyphen2, ' ‐', text);
|
|
45
|
-
text = text.replace(regexFigureDash, ' ‒', text);
|
|
52
|
+
// Replace prepositions with non-breaking space
|
|
53
|
+
textPart = textPart.replace(prepositionsRegex, '$2 ');
|
|
46
54
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
textPart = textPart.replace(regexMdash, ' —', textPart);
|
|
56
|
+
textPart = textPart.replace(regexNdash, ' –', textPart);
|
|
57
|
+
textPart = textPart.replace(regexHyphen, ' -', textPart);
|
|
58
|
+
textPart = textPart.replace(regexHyphen2, ' ‐', textPart);
|
|
59
|
+
textPart = textPart.replace(regexFigureDash, ' ‒', textPart);
|
|
60
|
+
|
|
61
|
+
textPart = textPart.replace(regexMdashEntity, ' —', textPart);
|
|
62
|
+
textPart = textPart.replace(regexNdashEntity, ' –', textPart);
|
|
63
|
+
textPart = textPart.replace(regexHyphenEntity, ' -', textPart);
|
|
64
|
+
textPart = textPart.replace(regexHyphen2Entity, ' ‐', textPart);
|
|
65
|
+
textPart = textPart.replace(regexFigureDashEntity, ' ‒', textPart);
|
|
66
|
+
textPart = textPart.replace(regexDashEntity, ' ‐', textPart);
|
|
67
|
+
|
|
68
|
+
textNoTags[i] = textPart;
|
|
69
|
+
}
|
|
53
70
|
|
|
54
|
-
|
|
71
|
+
// Iterate over regular text and and join back together with tags
|
|
72
|
+
return textNoTags.map((text, index) => {
|
|
73
|
+
return text + (textTags[index] || '');
|
|
74
|
+
}).join('');
|
|
55
75
|
}
|
|
56
76
|
|
|
57
77
|
module.exports = prepositionNbsp;
|
|
@@ -47,7 +47,7 @@ test('CSS nano ignore test', () => {
|
|
|
47
47
|
|
|
48
48
|
test('CSS nano nested calc test', () => {
|
|
49
49
|
return fsPromises.readFile(path.resolve(publicPath, 'assets/stylesheets/nested-calc-test.css'), {'encoding': 'utf8'}).then((css) => {
|
|
50
|
-
expect(css).toBe('body{padding-top:calc(10vw +
|
|
50
|
+
expect(css).toBe('body{padding-top:calc(10vw + 15vh)}');
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
|
|
@@ -36,6 +36,12 @@ test('preposition_nbsp hyphens', () => {
|
|
|
36
36
|
expect(preposition_nbsp('hello ‒ at world')).toEqual('hello ‒ at world');
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
+
test('preposition_nbsp skip tags', () => {
|
|
40
|
+
expect(preposition_nbsp('<a href="https://www.google.com">A nice day</a>')).toEqual('<a href="https://www.google.com">A nice day</a>');
|
|
41
|
+
expect(preposition_nbsp('Start <a download>This is a nice day</a> at <a download>another nice day</a>')).toEqual('Start <a download>This is a nice day</a> at <a download>another nice day</a>');
|
|
42
|
+
expect(preposition_nbsp('<link rel="preload" href="/assets/fonts/...ttf" as="font" type="font/ttf" crossorigin>')).toEqual('<link rel="preload" href="/assets/fonts/...ttf" as="font" type="font/ttf" crossorigin>');
|
|
43
|
+
});
|
|
44
|
+
|
|
39
45
|
test('Preposition TWIG filter applied', () => {
|
|
40
46
|
return fsPromises.readFile(path.resolve(publicPath, 'preposition.html'), {'encoding': 'utf8'}).then((html) => {
|
|
41
47
|
expect(html).toBe('<html><body>hello at world</body></html>');
|