@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,208 +1,208 @@
|
|
|
1
|
-
// 2025-01-20, Kaspars Zuks: added "options.data" support for variables
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { Transform } from 'stream';
|
|
6
|
-
import picocolors from 'picocolors';
|
|
7
|
-
import PluginError from 'plugin-error';
|
|
8
|
-
import replaceExtension from 'replace-ext';
|
|
9
|
-
import stripAnsi from 'strip-ansi';
|
|
10
|
-
import clonedeep from 'lodash.clonedeep';
|
|
11
|
-
import applySourceMap from 'vinyl-sourcemaps-apply';
|
|
12
|
-
import sassStingify from './sass-stringify.js';
|
|
13
|
-
|
|
14
|
-
const PLUGIN_NAME = 'gulp-sass';
|
|
15
|
-
|
|
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
|
-
const transfob = (transform) => new Transform({ transform, objectMode: true });
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Handles returning the file to the stream
|
|
30
|
-
*/
|
|
31
|
-
const filePush = (file, sassObject, callback) => {
|
|
32
|
-
// Build Source Maps!
|
|
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;
|
|
59
|
-
file.path = replaceExtension(file.path, '.css');
|
|
60
|
-
|
|
61
|
-
if (file.stat) {
|
|
62
|
-
file.stat.atime = file.stat.mtime = file.stat.ctime = new Date();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
callback(null, file);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Handles error message
|
|
70
|
-
*/
|
|
71
|
-
const handleError = (error, file, callback) => {
|
|
72
|
-
const filePath = (error.file === 'stdin' ? file.path : error.file) || file.path;
|
|
73
|
-
const relativePath = path.relative(process.cwd(), filePath);
|
|
74
|
-
const message = `${picocolors.underline(relativePath)}\n${error.formatted}`;
|
|
75
|
-
|
|
76
|
-
error.messageFormatted = message;
|
|
77
|
-
error.messageOriginal = error.message;
|
|
78
|
-
error.message = stripAnsi(message);
|
|
79
|
-
error.relativePath = relativePath;
|
|
80
|
-
|
|
81
|
-
return callback(new PluginError(PLUGIN_NAME, error));
|
|
82
|
-
};
|
|
83
|
-
|
|
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
|
-
/**
|
|
99
|
-
* Main Gulp Sass function
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
|
-
// eslint-disable-next-line arrow-body-style
|
|
103
|
-
const gulpSass = (options, sync) => {
|
|
104
|
-
return transfob((file, encoding, callback) => {
|
|
105
|
-
if (file.isNull()) {
|
|
106
|
-
callback(null, file);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (file.isStream()) {
|
|
111
|
-
callback(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (path.basename(file.path).startsWith('_')) {
|
|
116
|
-
callback();
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (!file.contents.length) {
|
|
121
|
-
file.path = replaceExtension(file.path, '.css');
|
|
122
|
-
callback(null, file);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const opts = clonedeep(options || {});
|
|
127
|
-
opts.data = file.contents.toString();
|
|
128
|
-
|
|
129
|
-
// Stringiyfy variables
|
|
130
|
-
if (options.data) {
|
|
131
|
-
opts.data = sassStingify(options.data) + opts.data;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// We set the file path here so that libsass can correctly resolve import paths
|
|
135
|
-
opts.file = file.path;
|
|
136
|
-
|
|
137
|
-
// Ensure `indentedSyntax` is true if a `.sass` file
|
|
138
|
-
if (path.extname(file.path) === '.sass') {
|
|
139
|
-
opts.indentedSyntax = true;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Ensure file's parent directory in the include path
|
|
143
|
-
if (opts.includePaths) {
|
|
144
|
-
if (typeof opts.includePaths === 'string') {
|
|
145
|
-
opts.includePaths = [opts.includePaths];
|
|
146
|
-
}
|
|
147
|
-
} else {
|
|
148
|
-
opts.includePaths = [];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
opts.includePaths.unshift(path.dirname(file.path));
|
|
152
|
-
|
|
153
|
-
// Generate Source Maps if the source-map plugin is present
|
|
154
|
-
if (file.sourceMap) {
|
|
155
|
-
opts.sourceMap = file.path;
|
|
156
|
-
opts.omitSourceMapUrl = true;
|
|
157
|
-
opts.sourceMapContents = true;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if (sync !== true) {
|
|
161
|
-
/**
|
|
162
|
-
* Async Sass render
|
|
163
|
-
*/
|
|
164
|
-
gulpSass.compiler.render(opts, (error, obj) => {
|
|
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
|
-
}
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Sync Sass render
|
|
187
|
-
*/
|
|
188
|
-
gulpSass.sync = (options) => gulpSass(options, true);
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Log errors nicely
|
|
192
|
-
*/
|
|
193
|
-
gulpSass.logError = function logError(error) {
|
|
194
|
-
const message = new PluginError('sass', error.messageFormatted).toString();
|
|
195
|
-
process.stderr.write(`${message}\n`);
|
|
196
|
-
this.emit('end');
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
export default (compiler) => {
|
|
200
|
-
if (!compiler || !compiler.render) {
|
|
201
|
-
const message = new PluginError(PLUGIN_NAME, MISSING_COMPILER_MESSAGE, { showProperties: false }).toString();
|
|
202
|
-
process.stderr.write(`${message}\n`);
|
|
203
|
-
process.exit(1);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
gulpSass.compiler = compiler;
|
|
207
|
-
return gulpSass;
|
|
208
|
-
};
|
|
1
|
+
// 2025-01-20, Kaspars Zuks: added "options.data" support for variables
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { Transform } from 'stream';
|
|
6
|
+
import picocolors from 'picocolors';
|
|
7
|
+
import PluginError from 'plugin-error';
|
|
8
|
+
import replaceExtension from 'replace-ext';
|
|
9
|
+
import stripAnsi from 'strip-ansi';
|
|
10
|
+
import clonedeep from 'lodash.clonedeep';
|
|
11
|
+
import applySourceMap from 'vinyl-sourcemaps-apply';
|
|
12
|
+
import sassStingify from './sass-stringify.js';
|
|
13
|
+
|
|
14
|
+
const PLUGIN_NAME = 'gulp-sass';
|
|
15
|
+
|
|
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
|
+
const transfob = (transform) => new Transform({ transform, objectMode: true });
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Handles returning the file to the stream
|
|
30
|
+
*/
|
|
31
|
+
const filePush = (file, sassObject, callback) => {
|
|
32
|
+
// Build Source Maps!
|
|
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;
|
|
59
|
+
file.path = replaceExtension(file.path, '.css');
|
|
60
|
+
|
|
61
|
+
if (file.stat) {
|
|
62
|
+
file.stat.atime = file.stat.mtime = file.stat.ctime = new Date();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
callback(null, file);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Handles error message
|
|
70
|
+
*/
|
|
71
|
+
const handleError = (error, file, callback) => {
|
|
72
|
+
const filePath = (error.file === 'stdin' ? file.path : error.file) || file.path;
|
|
73
|
+
const relativePath = path.relative(process.cwd(), filePath);
|
|
74
|
+
const message = `${picocolors.underline(relativePath)}\n${error.formatted}`;
|
|
75
|
+
|
|
76
|
+
error.messageFormatted = message;
|
|
77
|
+
error.messageOriginal = error.message;
|
|
78
|
+
error.message = stripAnsi(message);
|
|
79
|
+
error.relativePath = relativePath;
|
|
80
|
+
|
|
81
|
+
return callback(new PluginError(PLUGIN_NAME, error));
|
|
82
|
+
};
|
|
83
|
+
|
|
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
|
+
/**
|
|
99
|
+
* Main Gulp Sass function
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
// eslint-disable-next-line arrow-body-style
|
|
103
|
+
const gulpSass = (options, sync) => {
|
|
104
|
+
return transfob((file, encoding, callback) => {
|
|
105
|
+
if (file.isNull()) {
|
|
106
|
+
callback(null, file);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (file.isStream()) {
|
|
111
|
+
callback(new PluginError(PLUGIN_NAME, 'Streaming not supported'));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (path.basename(file.path).startsWith('_')) {
|
|
116
|
+
callback();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (!file.contents.length) {
|
|
121
|
+
file.path = replaceExtension(file.path, '.css');
|
|
122
|
+
callback(null, file);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const opts = clonedeep(options || {});
|
|
127
|
+
opts.data = file.contents.toString();
|
|
128
|
+
|
|
129
|
+
// Stringiyfy variables
|
|
130
|
+
if (options.data) {
|
|
131
|
+
opts.data = sassStingify(options.data) + opts.data;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// We set the file path here so that libsass can correctly resolve import paths
|
|
135
|
+
opts.file = file.path;
|
|
136
|
+
|
|
137
|
+
// Ensure `indentedSyntax` is true if a `.sass` file
|
|
138
|
+
if (path.extname(file.path) === '.sass') {
|
|
139
|
+
opts.indentedSyntax = true;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Ensure file's parent directory in the include path
|
|
143
|
+
if (opts.includePaths) {
|
|
144
|
+
if (typeof opts.includePaths === 'string') {
|
|
145
|
+
opts.includePaths = [opts.includePaths];
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
opts.includePaths = [];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
opts.includePaths.unshift(path.dirname(file.path));
|
|
152
|
+
|
|
153
|
+
// Generate Source Maps if the source-map plugin is present
|
|
154
|
+
if (file.sourceMap) {
|
|
155
|
+
opts.sourceMap = file.path;
|
|
156
|
+
opts.omitSourceMapUrl = true;
|
|
157
|
+
opts.sourceMapContents = true;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (sync !== true) {
|
|
161
|
+
/**
|
|
162
|
+
* Async Sass render
|
|
163
|
+
*/
|
|
164
|
+
gulpSass.compiler.render(opts, (error, obj) => {
|
|
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
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Sync Sass render
|
|
187
|
+
*/
|
|
188
|
+
gulpSass.sync = (options) => gulpSass(options, true);
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Log errors nicely
|
|
192
|
+
*/
|
|
193
|
+
gulpSass.logError = function logError(error) {
|
|
194
|
+
const message = new PluginError('sass', error.messageFormatted).toString();
|
|
195
|
+
process.stderr.write(`${message}\n`);
|
|
196
|
+
this.emit('end');
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export default (compiler) => {
|
|
200
|
+
if (!compiler || !compiler.render) {
|
|
201
|
+
const message = new PluginError(PLUGIN_NAME, MISSING_COMPILER_MESSAGE, { showProperties: false }).toString();
|
|
202
|
+
process.stderr.write(`${message}\n`);
|
|
203
|
+
process.exit(1);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
gulpSass.compiler = compiler;
|
|
207
|
+
return gulpSass;
|
|
208
|
+
};
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "gulp-sass",
|
|
3
|
-
"version": "5.1.0",
|
|
4
|
-
"description": "Gulp plugin for sass",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"engines": {
|
|
7
|
-
"node": ">=12"
|
|
8
|
-
},
|
|
9
|
-
"type": "module",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .",
|
|
12
|
-
"fix": "npm run lint -- --fix",
|
|
13
|
-
"mocha": "mocha",
|
|
14
|
-
"test": "npm run test:node-sass && npm run test:dart-sass",
|
|
15
|
-
"test:node-sass": "mocha",
|
|
16
|
-
"test:dart-sass": "mocha -- --sass"
|
|
17
|
-
},
|
|
18
|
-
"repository": {
|
|
19
|
-
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/dlmanning/gulp-sass.git"
|
|
21
|
-
},
|
|
22
|
-
"keywords": [
|
|
23
|
-
"gulpplugin",
|
|
24
|
-
"sass",
|
|
25
|
-
"gulp"
|
|
26
|
-
],
|
|
27
|
-
"author": "David Manning",
|
|
28
|
-
"license": "MIT",
|
|
29
|
-
"bugs": {
|
|
30
|
-
"url": "https://github.com/dlmanning/gulp-sass/issues"
|
|
31
|
-
},
|
|
32
|
-
"homepage": "https://github.com/dlmanning/gulp-sass#readme",
|
|
33
|
-
"files": [
|
|
34
|
-
"index.js"
|
|
35
|
-
],
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"lodash.clonedeep": "^4.5.0",
|
|
38
|
-
"picocolors": "^1.0.0",
|
|
39
|
-
"plugin-error": "^1.0.1",
|
|
40
|
-
"replace-ext": "^2.0.0",
|
|
41
|
-
"strip-ansi": "^6.0.1",
|
|
42
|
-
"vinyl-sourcemaps-apply": "^0.2.1"
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"autoprefixer": "^10.4.0",
|
|
46
|
-
"eslint": "^8.5.0",
|
|
47
|
-
"eslint-config-airbnb-base": "^15.0.0",
|
|
48
|
-
"eslint-plugin-import": "^2.25.3",
|
|
49
|
-
"globule": "^1.3.3",
|
|
50
|
-
"gulp": "^4.0.2",
|
|
51
|
-
"gulp-postcss": "^9.0.1",
|
|
52
|
-
"gulp-sourcemaps": "^3.0.0",
|
|
53
|
-
"gulp-tap": "^2.0.0",
|
|
54
|
-
"mocha": "^9.1.3",
|
|
55
|
-
"node-sass": "^7.0.1",
|
|
56
|
-
"postcss": "^8.4.5",
|
|
57
|
-
"rimraf": "^3.0.2",
|
|
58
|
-
"sass": "^1.45.1",
|
|
59
|
-
"vinyl": "^2.2.1"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "gulp-sass",
|
|
3
|
+
"version": "5.1.0",
|
|
4
|
+
"description": "Gulp plugin for sass",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=12"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .",
|
|
12
|
+
"fix": "npm run lint -- --fix",
|
|
13
|
+
"mocha": "mocha",
|
|
14
|
+
"test": "npm run test:node-sass && npm run test:dart-sass",
|
|
15
|
+
"test:node-sass": "mocha",
|
|
16
|
+
"test:dart-sass": "mocha -- --sass"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/dlmanning/gulp-sass.git"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"gulpplugin",
|
|
24
|
+
"sass",
|
|
25
|
+
"gulp"
|
|
26
|
+
],
|
|
27
|
+
"author": "David Manning",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/dlmanning/gulp-sass/issues"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/dlmanning/gulp-sass#readme",
|
|
33
|
+
"files": [
|
|
34
|
+
"index.js"
|
|
35
|
+
],
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"lodash.clonedeep": "^4.5.0",
|
|
38
|
+
"picocolors": "^1.0.0",
|
|
39
|
+
"plugin-error": "^1.0.1",
|
|
40
|
+
"replace-ext": "^2.0.0",
|
|
41
|
+
"strip-ansi": "^6.0.1",
|
|
42
|
+
"vinyl-sourcemaps-apply": "^0.2.1"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"autoprefixer": "^10.4.0",
|
|
46
|
+
"eslint": "^8.5.0",
|
|
47
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
48
|
+
"eslint-plugin-import": "^2.25.3",
|
|
49
|
+
"globule": "^1.3.3",
|
|
50
|
+
"gulp": "^4.0.2",
|
|
51
|
+
"gulp-postcss": "^9.0.1",
|
|
52
|
+
"gulp-sourcemaps": "^3.0.0",
|
|
53
|
+
"gulp-tap": "^2.0.0",
|
|
54
|
+
"mocha": "^9.1.3",
|
|
55
|
+
"node-sass": "^7.0.1",
|
|
56
|
+
"postcss": "^8.4.5",
|
|
57
|
+
"rimraf": "^3.0.2",
|
|
58
|
+
"sass": "^1.45.1",
|
|
59
|
+
"vinyl": "^2.2.1"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
export default function sassStingify (data, isDeep = false) {
|
|
2
|
-
if (data === null || data === undefined) {
|
|
3
|
-
return 'false';
|
|
4
|
-
} else if (data !== '' && (data === 'true' || data === 'false' || data === true || data === false || !isNaN(data))) {
|
|
5
|
-
// Convert to simple value
|
|
6
|
-
return String(data);
|
|
7
|
-
} else if (Array.isArray(data)) {
|
|
8
|
-
const out = data.map((item) => sassStingify(item, true));
|
|
9
|
-
return `(${ out })`;
|
|
10
|
-
} else if (data && typeof data === 'object') {
|
|
11
|
-
const out = [];
|
|
12
|
-
for (let key in data) {
|
|
13
|
-
out.push(`${key}: ${sassStingify(data[key], true)}`);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (out.length) {
|
|
17
|
-
if (isDeep) {
|
|
18
|
-
return `(${ out.join(', ') })`;
|
|
19
|
-
} else {
|
|
20
|
-
return `$${ out.join(';$') };`;
|
|
21
|
-
}
|
|
22
|
-
} else {
|
|
23
|
-
return '';
|
|
24
|
-
}
|
|
25
|
-
} else {
|
|
26
|
-
// Convert to string
|
|
27
|
-
return "'" + data.toString()
|
|
28
|
-
.replace(/\\/g, '\\\\')
|
|
29
|
-
.replace(/'/g, '\\\'')
|
|
30
|
-
.replace(/\n/g, '\\n') + "'";
|
|
31
|
-
}
|
|
32
|
-
};
|
|
1
|
+
export default function sassStingify (data, isDeep = false) {
|
|
2
|
+
if (data === null || data === undefined) {
|
|
3
|
+
return 'false';
|
|
4
|
+
} else if (data !== '' && (data === 'true' || data === 'false' || data === true || data === false || !isNaN(data))) {
|
|
5
|
+
// Convert to simple value
|
|
6
|
+
return String(data);
|
|
7
|
+
} else if (Array.isArray(data)) {
|
|
8
|
+
const out = data.map((item) => sassStingify(item, true));
|
|
9
|
+
return `(${ out })`;
|
|
10
|
+
} else if (data && typeof data === 'object') {
|
|
11
|
+
const out = [];
|
|
12
|
+
for (let key in data) {
|
|
13
|
+
out.push(`${key}: ${sassStingify(data[key], true)}`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (out.length) {
|
|
17
|
+
if (isDeep) {
|
|
18
|
+
return `(${ out.join(', ') })`;
|
|
19
|
+
} else {
|
|
20
|
+
return `$${ out.join(';$') };`;
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
// Convert to string
|
|
27
|
+
return "'" + data.toString()
|
|
28
|
+
.replace(/\\/g, '\\\\')
|
|
29
|
+
.replace(/'/g, '\\\'')
|
|
30
|
+
.replace(/\n/g, '\\n') + "'";
|
|
31
|
+
}
|
|
32
|
+
};
|
package/vendor/gulp-twig/LICENSE
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
Copyright (c) 2014 Simon de Turck <simon@zimmen.com> www.zimmen.com
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
-
a copy of this software and associated documentation files (the
|
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
-
the following conditions:
|
|
10
|
-
|
|
11
|
-
The above copyright notice and this permission notice shall be
|
|
12
|
-
included in all copies or substantial portions of the Software.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
Copyright (c) 2014 Simon de Turck <simon@zimmen.com> www.zimmen.com
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|