@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 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
@@ -1,4 +1,4 @@
1
- var chalk = require('chalk');
1
+ const chalk = require('chalk');
2
2
 
3
3
  module.exports = function (error) {
4
4
  if (error.plugin) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@videinfra/static-website-builder",
3
- "version": "1.5.0",
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.12.3",
28
- "@babel/preset-env": "^7.12.1",
29
- "autoprefixer": "^9.6.1",
30
- "babel-loader": "^8.2.1",
31
- "browser-sync": "^2.26.13",
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.1",
34
- "cross-env": "^7.0.2",
35
- "cssnano": "^4.1.10",
36
- "del": "^5.1.0",
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": "^4.1.0",
46
+ "gulp-sass": "^5.1.0",
47
47
  "gulp-sizereport": "^1.2.1",
48
48
  "gulp-sourcemaps": "^3.0.0",
49
- "gulp-svgmin": "^3.0.0",
50
- "gulp-svgstore": "^7.0.1",
49
+ "gulp-svgmin": "^4.1.0",
50
+ "gulp-svgstore": "^9.0.0",
51
51
  "gulp-twig": "^1.2.0",
52
- "minimist": "^1.2.5",
53
- "nano-memoize": "^1.2.1",
54
- "webpack": "^4.44.2",
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": "^26.6.3"
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 sass = require('gulp-sass');
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
@@ -5,6 +5,9 @@ exports.stylesheets = {
5
5
  // Add sass to the extensions
6
6
  extensions: ['scss', 'sass'],
7
7
 
8
+ // Use legacy `node-sass` instead of `sass`
9
+ legacy: true,
10
+
8
11
  // SASS options
9
12
  // see https://github.com/sass/node-sass#options
10
13
  sass: {
@@ -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
- module.exports = function getData () {
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
+ }
@@ -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
- return gulp.src(getGlobPaths())
59
- .pipe(taskStart())
59
+ return function html () {
60
+ return gulp.src(getGlobPaths())
61
+ .pipe(taskStart())
60
62
 
61
- // Faster incremental builds, skip files which didn't changed or their dependencies didn't changed
62
- .pipe(gulpif(!!getConfig.getTaskConfig('html', 'dependents'), cached('html')))
63
- .pipe(gulpif(!!getConfig.getTaskConfig('html', 'dependents'), dependents(getConfig.getTaskConfig('dependents'))))
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
- // Prevent file from being rendered if it's in the ignore list
66
- .pipe(ignore.exclude(getGlobIgnorePaths(), {}))
67
+ // Prevent file from being rendered if it's in the ignore list
68
+ .pipe(ignore.exclude(getGlobIgnorePaths(), {}))
67
69
 
68
- // Preprocess using TWIG
69
- .pipe(gulpif(!!getConfig.getTaskConfig('html', 'engine'), data(getData)))
70
- .pipe(gulpif(!!getConfig.getTaskConfig('html', 'engine'), getEngine()))
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
- // Minify
73
- .pipe(gulpif(!!getConfig.getTaskConfig('html', 'htmlmin'), htmlmin(getConfig.getTaskConfig('html', 'htmlmin'))))
74
+ // Minify
75
+ .pipe(gulpif(!!getConfig.getTaskConfig('html', 'htmlmin'), htmlmin(getConfig.getTaskConfig('html', 'htmlmin'))))
74
76
 
75
- .pipe(taskBeforeDest())
76
- .pipe(gulp.dest(getPaths.getDestPath('html')))
77
+ .pipe(taskBeforeDest())
78
+ .pipe(gulp.dest(getPaths.getDestPath('html')))
77
79
 
78
- // Reload on change
79
- .pipe(taskEnd());
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;