@videinfra/static-website-builder 1.5.0 → 1.6.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 +14 -0
- package/init/index.js +0 -1
- package/lib/log-error.js +1 -1
- package/package.json +19 -17
- package/plugins/sass-engine/preprocess-config.js +2 -1
- package/plugins/sass.js +3 -0
- package/tasks/data/get-data.js +23 -1
- package/tasks/html/task.js +22 -19
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ 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.6.0] - 2022-06-20
|
|
8
|
+
### Updated
|
|
9
|
+
- gulp-sass to use latest node-sass version
|
|
10
|
+
### Added
|
|
11
|
+
- `stylesheets.legacy` configuration option to turn off `node-sass` and use `sass`
|
|
12
|
+
|
|
13
|
+
## [1.5.2] - 2022-06-17
|
|
14
|
+
### Updated
|
|
15
|
+
- In build mode prevent data from being read more than once
|
|
16
|
+
|
|
17
|
+
## [1.5.1] - 2022-04-14
|
|
18
|
+
### Fixed
|
|
19
|
+
- Dependency update
|
|
20
|
+
|
|
7
21
|
## [1.5.0] - 2022-04-13
|
|
8
22
|
### Fixed
|
|
9
23
|
- Read files in `data` folder recursively
|
package/init/index.js
CHANGED
|
@@ -6,7 +6,6 @@ const folderExists = require('../lib/init/folder-exists');
|
|
|
6
6
|
const getFolderList = require('../lib/init/get-folder-list');
|
|
7
7
|
const chalk = require('chalk');
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
module.exports = function init (template = 'default') {
|
|
11
10
|
let templateName = template || 'default';
|
|
12
11
|
let copyFrom = path.getBuilderPath('init', templateName);
|
package/lib/log-error.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@videinfra/static-website-builder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Customizable static site project builder",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
"test": "gulp build --silent --config=init/test/config/config.js && jest"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@babel/core": "^7.
|
|
28
|
-
"@babel/preset-env": "^7.
|
|
29
|
-
"autoprefixer": "^9.
|
|
30
|
-
"babel-loader": "^8.2.
|
|
31
|
-
"browser-sync": "^2.
|
|
27
|
+
"@babel/core": "^7.17.9",
|
|
28
|
+
"@babel/preset-env": "^7.16.11",
|
|
29
|
+
"autoprefixer": "^9.8.8",
|
|
30
|
+
"babel-loader": "^8.2.4",
|
|
31
|
+
"browser-sync": "^2.27.9",
|
|
32
32
|
"chalk": "4.0.0",
|
|
33
|
-
"chokidar": "^3.5.
|
|
34
|
-
"cross-env": "^7.0.
|
|
35
|
-
"cssnano": "^4.1.
|
|
36
|
-
"del": "^
|
|
33
|
+
"chokidar": "^3.5.3",
|
|
34
|
+
"cross-env": "^7.0.3",
|
|
35
|
+
"cssnano": "^4.1.11",
|
|
36
|
+
"del": "^6.0.0",
|
|
37
37
|
"gulp": "^4.0.2",
|
|
38
38
|
"gulp-cached": "^1.1.1",
|
|
39
39
|
"gulp-data": "^1.3.1",
|
|
@@ -43,18 +43,20 @@
|
|
|
43
43
|
"gulp-ignore": "^3.0.0",
|
|
44
44
|
"gulp-plumber": "^1.2.1",
|
|
45
45
|
"gulp-postcss": "^8.0.0",
|
|
46
|
-
"gulp-sass": "^
|
|
46
|
+
"gulp-sass": "^5.1.0",
|
|
47
47
|
"gulp-sizereport": "^1.2.1",
|
|
48
48
|
"gulp-sourcemaps": "^3.0.0",
|
|
49
|
-
"gulp-svgmin": "^
|
|
50
|
-
"gulp-svgstore": "^
|
|
49
|
+
"gulp-svgmin": "^4.1.0",
|
|
50
|
+
"gulp-svgstore": "^9.0.0",
|
|
51
51
|
"gulp-twig": "^1.2.0",
|
|
52
|
-
"minimist": "^1.2.
|
|
53
|
-
"nano-memoize": "^1.
|
|
54
|
-
"
|
|
52
|
+
"minimist": "^1.2.6",
|
|
53
|
+
"nano-memoize": "^1.3.0",
|
|
54
|
+
"node-sass": "^7.0.1",
|
|
55
|
+
"sass": "^1.52.3",
|
|
56
|
+
"webpack": "^4.46.0",
|
|
55
57
|
"webpack-stream": "^5.2.1"
|
|
56
58
|
},
|
|
57
59
|
"devDependencies": {
|
|
58
|
-
"jest": "^
|
|
60
|
+
"jest": "^27.5.1"
|
|
59
61
|
}
|
|
60
62
|
}
|
|
@@ -2,7 +2,7 @@ const paths = require('./../../lib/get-path');
|
|
|
2
2
|
const getConfig = require('./../../lib/get-config');
|
|
3
3
|
const getPaths = require('./../../lib/get-path');
|
|
4
4
|
const assign = require('lodash/assign');
|
|
5
|
-
const
|
|
5
|
+
const gulpSass = require('gulp-sass');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -22,6 +22,7 @@ module.exports = function processSASSConfig (config, fullConfig) {
|
|
|
22
22
|
|
|
23
23
|
// Engine is a function which returns a gulp pipe function
|
|
24
24
|
config.engine = function getSASSEngine () {
|
|
25
|
+
const sass = config.legacy ? gulpSass(require('node-sass')) : gulpSass(require('sass'));
|
|
25
26
|
return sass(getConfig.getTaskConfig('stylesheets', 'sass')).on('error', sass.logError)
|
|
26
27
|
};
|
|
27
28
|
|
package/plugins/sass.js
CHANGED
package/tasks/data/get-data.js
CHANGED
|
@@ -10,7 +10,7 @@ const getFileNamesSync = require('../../lib/get-file-names');
|
|
|
10
10
|
const camelizeFileName = require('../../lib/camelize-file-name');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
function getData () {
|
|
14
14
|
const folders = getPaths.getSourcePaths('data');
|
|
15
15
|
const extensions = getConfig.getTaskConfig('data', 'extensions');
|
|
16
16
|
const loaders = getConfig.getTaskConfig('data', 'loaders');
|
|
@@ -63,3 +63,25 @@ module.exports = function getData () {
|
|
|
63
63
|
|
|
64
64
|
return data;
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
let cache = null;
|
|
69
|
+
|
|
70
|
+
module.exports = function (options) {
|
|
71
|
+
const build = options && !!options.build;
|
|
72
|
+
|
|
73
|
+
return function () {
|
|
74
|
+
if (build) {
|
|
75
|
+
// Cache during full build
|
|
76
|
+
if (!cache) {
|
|
77
|
+
cache = getData();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return cache;
|
|
81
|
+
} else {
|
|
82
|
+
// Don't cache during watch build
|
|
83
|
+
cache = null;
|
|
84
|
+
return getData();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
package/tasks/html/task.js
CHANGED
|
@@ -53,36 +53,39 @@ const getEngine = memoize(function () {
|
|
|
53
53
|
return engine ? engine() : (() => {});
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
+
function html (options) {
|
|
57
|
+
const build = options && !!options.build;
|
|
56
58
|
|
|
57
|
-
function html () {
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
return function html () {
|
|
60
|
+
return gulp.src(getGlobPaths())
|
|
61
|
+
.pipe(taskStart())
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
// Faster incremental builds, skip files which didn't changed or their dependencies didn't changed
|
|
64
|
+
.pipe(gulpif(!!getConfig.getTaskConfig('html', 'dependents'), cached('html')))
|
|
65
|
+
.pipe(gulpif(!!getConfig.getTaskConfig('html', 'dependents'), dependents(getConfig.getTaskConfig('dependents'))))
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
// Prevent file from being rendered if it's in the ignore list
|
|
68
|
+
.pipe(ignore.exclude(getGlobIgnorePaths(), {}))
|
|
67
69
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
// Preprocess using TWIG
|
|
71
|
+
.pipe(gulpif(!!getConfig.getTaskConfig('html', 'engine'), data(getData({ build: build }))))
|
|
72
|
+
.pipe(gulpif(!!getConfig.getTaskConfig('html', 'engine'), getEngine()))
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
// Minify
|
|
75
|
+
.pipe(gulpif(!!getConfig.getTaskConfig('html', 'htmlmin'), htmlmin(getConfig.getTaskConfig('html', 'htmlmin'))))
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
.pipe(taskBeforeDest())
|
|
78
|
+
.pipe(gulp.dest(getPaths.getDestPath('html')))
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
// Reload on change
|
|
81
|
+
.pipe(taskEnd());
|
|
82
|
+
};
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
function htmlWatch () {
|
|
83
|
-
return taskWatch(getWatchGlobPaths(), html);
|
|
86
|
+
return taskWatch(getWatchGlobPaths(), html({ build: false }));
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
|
|
87
|
-
exports.build = html;
|
|
90
|
+
exports.build = html({ build: true });
|
|
88
91
|
exports.watch = htmlWatch;
|