@videinfra/static-website-builder 1.11.1 → 1.12.1
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 +8 -0
- package/init/index.js +56 -56
- package/init/test/config/config.js +36 -36
- package/init/test/src/stylesheets/autoprefixer-test.scss +3 -3
- 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 +4 -3
- package/lib/get-config.js +157 -157
- package/lib/get-file-names.js +23 -23
- package/lib/get-path.js +109 -109
- package/lib/globs-helper.js +136 -136
- package/lib/gulp/dynamic-task.js +8 -0
- package/lib/gulp/resolve-dynamic-task.js +11 -0
- package/lib/log-error.js +15 -15
- package/lib/merge.js +27 -27
- package/lib/run-preprocess.js +1 -1
- package/package.json +1 -1
- package/plugins/sass-engine/preprocess-config.js +54 -54
- package/plugins/sass.js +38 -38
- package/plugins/twig-engine/preprocess-config.js +47 -47
- package/plugins/twig.js +65 -65
- package/tasks/data/data-loader-js.js +5 -5
- package/tasks/data/get-data.js +87 -87
- package/tasks/html/task.js +91 -91
- package/tasks/icons/config.js +52 -52
- package/tasks/javascripts/config.js +13 -2
- package/tasks/javascripts/preprocess-config.js +121 -50
- package/tasks/javascripts/task.js +40 -16
- package/tasks/javascripts/webpack-url-version.js +32 -0
- package/tasks/stylesheets/config.js +88 -88
- package/tasks/stylesheets/preprocess-config.js +41 -41
- package/tasks/stylesheets/task.js +69 -69
- package/tests/build/build.test.js +101 -101
- package/tests/camelize-file-name.test.js +11 -11
- package/tests/glob-helper.test.js +99 -99
- package/tests/run-preprocess.test.js +2 -1
- package/vendor/gulp-twig/LICENSE +20 -20
- package/vendor/gulp-twig/README.md +167 -167
- package/vendor/gulp-twig/index.js +130 -130
- package/vendor/gulp-twig/package.json +43 -43
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
// 2024-02-13, Kaspars Zuks: added "options.async" support
|
|
2
|
-
var map = require('map-stream');
|
|
3
|
-
var rext = require('replace-ext');
|
|
4
|
-
var log = require('fancy-log');
|
|
5
|
-
var PluginError = require('plugin-error');
|
|
6
|
-
|
|
7
|
-
const PLUGIN_NAME = 'gulp-twig';
|
|
8
|
-
|
|
9
|
-
module.exports = function (options) {
|
|
10
|
-
'use strict';
|
|
11
|
-
options = Object.assign({}, {
|
|
12
|
-
changeExt: true,
|
|
13
|
-
extname: '.html',
|
|
14
|
-
useFileContents: false,
|
|
15
|
-
async: true,
|
|
16
|
-
}, options || {});
|
|
17
|
-
|
|
18
|
-
function modifyContents(file, cb) {
|
|
19
|
-
var data = file.data || Object.assign({}, options.data);
|
|
20
|
-
|
|
21
|
-
if (file.isNull()) {
|
|
22
|
-
return cb(null, file);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (file.isStream()) {
|
|
26
|
-
return cb(new PluginError(PLUGIN_NAME, 'Streaming not supported!'));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
data._file = file;
|
|
30
|
-
if(options.changeExt === false || options.extname === true){
|
|
31
|
-
data._target = {
|
|
32
|
-
path: file.path,
|
|
33
|
-
relative: file.relative
|
|
34
|
-
}
|
|
35
|
-
}else{
|
|
36
|
-
data._target = {
|
|
37
|
-
path: rext(file.path, options.extname || ''),
|
|
38
|
-
relative: rext(file.relative, options.extname || '')
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var Twig = require('twig'),
|
|
43
|
-
twig = Twig.twig,
|
|
44
|
-
twigOpts = {
|
|
45
|
-
path: file.path,
|
|
46
|
-
async: false
|
|
47
|
-
},
|
|
48
|
-
template;
|
|
49
|
-
|
|
50
|
-
if (options.debug !== undefined) {
|
|
51
|
-
twigOpts.debug = options.debug;
|
|
52
|
-
}
|
|
53
|
-
if (options.trace !== undefined) {
|
|
54
|
-
twigOpts.trace = options.trace;
|
|
55
|
-
}
|
|
56
|
-
if (options.base !== undefined) {
|
|
57
|
-
twigOpts.base = options.base;
|
|
58
|
-
}
|
|
59
|
-
if (options.namespaces !== undefined) {
|
|
60
|
-
twigOpts.namespaces = options.namespaces;
|
|
61
|
-
}
|
|
62
|
-
if (options.cache !== true) {
|
|
63
|
-
Twig.cache(false);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (options.functions) {
|
|
67
|
-
options.functions.forEach(function (func) {
|
|
68
|
-
Twig.extendFunction(func.name, func.func);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (options.filters) {
|
|
73
|
-
options.filters.forEach(function (filter) {
|
|
74
|
-
Twig.extendFilter(filter.name, filter.func);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if(options.extend) {
|
|
79
|
-
Twig.extend(options.extend);
|
|
80
|
-
delete options.extend;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (options.useFileContents) {
|
|
84
|
-
var fileContents = file.contents.toString();
|
|
85
|
-
twigOpts.data = fileContents
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
template = twig(twigOpts);
|
|
89
|
-
|
|
90
|
-
if (options.async) {
|
|
91
|
-
template.renderAsync(data)
|
|
92
|
-
.then(function (output) {
|
|
93
|
-
file.contents = new Buffer(output);
|
|
94
|
-
file.path = data._target.path;
|
|
95
|
-
cb(null, file);
|
|
96
|
-
})
|
|
97
|
-
.catch(function (e) {
|
|
98
|
-
if (options.errorLogToConsole) {
|
|
99
|
-
log(PLUGIN_NAME + ' ' + e);
|
|
100
|
-
cb();
|
|
101
|
-
} else if (typeof options.onError === 'function') {
|
|
102
|
-
options.onError(e);
|
|
103
|
-
cb();
|
|
104
|
-
} else {
|
|
105
|
-
cb(new PluginError(PLUGIN_NAME, e));
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
} else {
|
|
109
|
-
try {
|
|
110
|
-
file.contents = new Buffer(template.render(data));
|
|
111
|
-
}catch(e){
|
|
112
|
-
if (options.errorLogToConsole) {
|
|
113
|
-
log(PLUGIN_NAME + ' ' + e);
|
|
114
|
-
return cb();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (typeof options.onError === 'function') {
|
|
118
|
-
options.onError(e);
|
|
119
|
-
return cb();
|
|
120
|
-
}
|
|
121
|
-
return cb(new PluginError(PLUGIN_NAME, e));
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
file.path = data._target.path;
|
|
125
|
-
cb(null, file);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return map(modifyContents);
|
|
130
|
-
};
|
|
1
|
+
// 2024-02-13, Kaspars Zuks: added "options.async" support
|
|
2
|
+
var map = require('map-stream');
|
|
3
|
+
var rext = require('replace-ext');
|
|
4
|
+
var log = require('fancy-log');
|
|
5
|
+
var PluginError = require('plugin-error');
|
|
6
|
+
|
|
7
|
+
const PLUGIN_NAME = 'gulp-twig';
|
|
8
|
+
|
|
9
|
+
module.exports = function (options) {
|
|
10
|
+
'use strict';
|
|
11
|
+
options = Object.assign({}, {
|
|
12
|
+
changeExt: true,
|
|
13
|
+
extname: '.html',
|
|
14
|
+
useFileContents: false,
|
|
15
|
+
async: true,
|
|
16
|
+
}, options || {});
|
|
17
|
+
|
|
18
|
+
function modifyContents(file, cb) {
|
|
19
|
+
var data = file.data || Object.assign({}, options.data);
|
|
20
|
+
|
|
21
|
+
if (file.isNull()) {
|
|
22
|
+
return cb(null, file);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (file.isStream()) {
|
|
26
|
+
return cb(new PluginError(PLUGIN_NAME, 'Streaming not supported!'));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
data._file = file;
|
|
30
|
+
if(options.changeExt === false || options.extname === true){
|
|
31
|
+
data._target = {
|
|
32
|
+
path: file.path,
|
|
33
|
+
relative: file.relative
|
|
34
|
+
}
|
|
35
|
+
}else{
|
|
36
|
+
data._target = {
|
|
37
|
+
path: rext(file.path, options.extname || ''),
|
|
38
|
+
relative: rext(file.relative, options.extname || '')
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var Twig = require('twig'),
|
|
43
|
+
twig = Twig.twig,
|
|
44
|
+
twigOpts = {
|
|
45
|
+
path: file.path,
|
|
46
|
+
async: false
|
|
47
|
+
},
|
|
48
|
+
template;
|
|
49
|
+
|
|
50
|
+
if (options.debug !== undefined) {
|
|
51
|
+
twigOpts.debug = options.debug;
|
|
52
|
+
}
|
|
53
|
+
if (options.trace !== undefined) {
|
|
54
|
+
twigOpts.trace = options.trace;
|
|
55
|
+
}
|
|
56
|
+
if (options.base !== undefined) {
|
|
57
|
+
twigOpts.base = options.base;
|
|
58
|
+
}
|
|
59
|
+
if (options.namespaces !== undefined) {
|
|
60
|
+
twigOpts.namespaces = options.namespaces;
|
|
61
|
+
}
|
|
62
|
+
if (options.cache !== true) {
|
|
63
|
+
Twig.cache(false);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (options.functions) {
|
|
67
|
+
options.functions.forEach(function (func) {
|
|
68
|
+
Twig.extendFunction(func.name, func.func);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (options.filters) {
|
|
73
|
+
options.filters.forEach(function (filter) {
|
|
74
|
+
Twig.extendFilter(filter.name, filter.func);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if(options.extend) {
|
|
79
|
+
Twig.extend(options.extend);
|
|
80
|
+
delete options.extend;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (options.useFileContents) {
|
|
84
|
+
var fileContents = file.contents.toString();
|
|
85
|
+
twigOpts.data = fileContents
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
template = twig(twigOpts);
|
|
89
|
+
|
|
90
|
+
if (options.async) {
|
|
91
|
+
template.renderAsync(data)
|
|
92
|
+
.then(function (output) {
|
|
93
|
+
file.contents = new Buffer(output);
|
|
94
|
+
file.path = data._target.path;
|
|
95
|
+
cb(null, file);
|
|
96
|
+
})
|
|
97
|
+
.catch(function (e) {
|
|
98
|
+
if (options.errorLogToConsole) {
|
|
99
|
+
log(PLUGIN_NAME + ' ' + e);
|
|
100
|
+
cb();
|
|
101
|
+
} else if (typeof options.onError === 'function') {
|
|
102
|
+
options.onError(e);
|
|
103
|
+
cb();
|
|
104
|
+
} else {
|
|
105
|
+
cb(new PluginError(PLUGIN_NAME, e));
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
} else {
|
|
109
|
+
try {
|
|
110
|
+
file.contents = new Buffer(template.render(data));
|
|
111
|
+
}catch(e){
|
|
112
|
+
if (options.errorLogToConsole) {
|
|
113
|
+
log(PLUGIN_NAME + ' ' + e);
|
|
114
|
+
return cb();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (typeof options.onError === 'function') {
|
|
118
|
+
options.onError(e);
|
|
119
|
+
return cb();
|
|
120
|
+
}
|
|
121
|
+
return cb(new PluginError(PLUGIN_NAME, e));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
file.path = data._target.path;
|
|
125
|
+
cb(null, file);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return map(modifyContents);
|
|
130
|
+
};
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "gulp-twig",
|
|
3
|
-
"description": "Twig.js plugin for gulp.js (gulpjs.com)",
|
|
4
|
-
"version": "1.2.0",
|
|
5
|
-
"homepage": "http://github.com/zimmen/gulp-twig",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "http://github.com/zimmen/gulp-twig.git"
|
|
9
|
-
},
|
|
10
|
-
"author": "Simon de Turck <simon@zimmen.com> (http://www.zimmen.com)",
|
|
11
|
-
"main": "./index.js",
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"fancy-log": "^1.3.2",
|
|
14
|
-
"map-stream": "^0.1.0",
|
|
15
|
-
"plugin-error": "^0.1.2",
|
|
16
|
-
"replace-ext": "^1.0.0",
|
|
17
|
-
"twig": "^1.10.5"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"mocha": "*",
|
|
21
|
-
"should": "*",
|
|
22
|
-
"vinyl": "^2.1.0"
|
|
23
|
-
},
|
|
24
|
-
"scripts": {
|
|
25
|
-
"test": "mocha -R spec"
|
|
26
|
-
},
|
|
27
|
-
"engines": {
|
|
28
|
-
"node": ">=4.0"
|
|
29
|
-
},
|
|
30
|
-
"keywords": [
|
|
31
|
-
"twig",
|
|
32
|
-
"twig.js",
|
|
33
|
-
"gulp",
|
|
34
|
-
"gulpplugin",
|
|
35
|
-
"gulp-plugin"
|
|
36
|
-
],
|
|
37
|
-
"licenses": [
|
|
38
|
-
{
|
|
39
|
-
"type": "MIT",
|
|
40
|
-
"url": "http://github.com/zimmen/gulp-twig/raw/master/LICENSE"
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "gulp-twig",
|
|
3
|
+
"description": "Twig.js plugin for gulp.js (gulpjs.com)",
|
|
4
|
+
"version": "1.2.0",
|
|
5
|
+
"homepage": "http://github.com/zimmen/gulp-twig",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "http://github.com/zimmen/gulp-twig.git"
|
|
9
|
+
},
|
|
10
|
+
"author": "Simon de Turck <simon@zimmen.com> (http://www.zimmen.com)",
|
|
11
|
+
"main": "./index.js",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"fancy-log": "^1.3.2",
|
|
14
|
+
"map-stream": "^0.1.0",
|
|
15
|
+
"plugin-error": "^0.1.2",
|
|
16
|
+
"replace-ext": "^1.0.0",
|
|
17
|
+
"twig": "^1.10.5"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"mocha": "*",
|
|
21
|
+
"should": "*",
|
|
22
|
+
"vinyl": "^2.1.0"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "mocha -R spec"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=4.0"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"twig",
|
|
32
|
+
"twig.js",
|
|
33
|
+
"gulp",
|
|
34
|
+
"gulpplugin",
|
|
35
|
+
"gulp-plugin"
|
|
36
|
+
],
|
|
37
|
+
"licenses": [
|
|
38
|
+
{
|
|
39
|
+
"type": "MIT",
|
|
40
|
+
"url": "http://github.com/zimmen/gulp-twig/raw/master/LICENSE"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|