@videinfra/static-website-builder 2.0.4 → 2.0.6
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 +226 -214
- 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 -3
- package/init/test/config/config.js +71 -71
- 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 -203
- 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 +135 -96
- package/tasks/env/config.js +26 -26
- package/tasks/env/get-env.js +113 -113
- package/tasks/fonts/config.js +24 -24
- package/tasks/fonts/task.js +51 -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 +159 -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
package/README.md
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
[npm-url]: https://npmjs.org/package/@videinfra/static-website-builder
|
|
2
|
-
[npm-image]: http://img.shields.io/npm/v/@videinfra/static-website-builder.svg
|
|
3
|
-
[travis-url]: https://travis-ci.org/videinfra/static-website-builder
|
|
4
|
-
[travis-image]: https://travis-ci.org/videinfra/static-website-builder.svg?branch=master
|
|
5
|
-
|
|
6
|
-
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]
|
|
7
|
-
|
|
8
|
-
`static-website-builder` is a customizable static site project builder powered by Gulp, Rolldown, SASS, PostCSS, TwigJS, BrowserSync
|
|
9
|
-
|
|
10
|
-
## Requirements
|
|
11
|
-
|
|
12
|
-
- Node.js >= 20.0.0
|
|
13
|
-
|
|
14
|
-
## Features
|
|
15
|
-
|
|
16
|
-
- Gulp: built using gulp
|
|
17
|
-
- Built-in Server: Local development server with hot reloading
|
|
18
|
-
- Templates: HTML templates with minification
|
|
19
|
-
- TWIG: Optional TwigJS template engine with optional plugins for additional functions and filters
|
|
20
|
-
- Stylesheets: Autoprefixing and minification with PostCSS support
|
|
21
|
-
- SASS: Optional SASS / SCSS compilation
|
|
22
|
-
- Javascript/Typescript: Transpilation, bundling and minification with rolldown
|
|
23
|
-
- SVG icons: Sprite generation from individual SVG files
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* Paths: Source and destinations paths are configurable
|
|
27
|
-
* Features: All features can be configured or disabled
|
|
28
|
-
* Plugins: create additional plugins / gulp tasks
|
|
29
|
-
|
|
30
|
-
## Quick start
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
npm init
|
|
34
|
-
npm install @videinfra/static-website-builder --save
|
|
35
|
-
npx builder init
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Start development server
|
|
39
|
-
```
|
|
40
|
-
npm run start
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Build production files
|
|
44
|
-
```
|
|
45
|
-
npm run start
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Note: these commands are added to the project during `npm init`.
|
|
49
|
-
|
|
50
|
-
## Commands
|
|
51
|
-
|
|
52
|
-
### Development server
|
|
53
|
-
|
|
54
|
-
```npx run builder watch```
|
|
55
|
-
|
|
56
|
-
### Generate production ready files
|
|
57
|
-
|
|
58
|
-
```npx run builder build```
|
|
59
|
-
|
|
60
|
-
### List all available tasks
|
|
61
|
-
|
|
62
|
-
```npx run builder --tasks```
|
|
63
|
-
|
|
64
|
-
## Project templates
|
|
65
|
-
|
|
66
|
-
As used in quick start, project templates are used to generate boilerplate / starter files and add commands to the project:
|
|
67
|
-
|
|
68
|
-
- [`default`](https://github.com/videinfra/static-website-builder/tree/master/init/default) - simple template with normalize.scss
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
## Plugins
|
|
72
|
-
|
|
73
|
-
Built-in plugins:
|
|
74
|
-
- `sass` - adds `.sass` and `.scss` file rendering using SASS
|
|
75
|
-
- `twig` - adds `.twig` file rendering using TwigJS
|
|
76
|
-
- `twig/symfony-filters` - adds `humanize` filter as found in Symfony
|
|
77
|
-
- `twig/symfony-functions` - adds `asset` function as found in Symfony
|
|
78
|
-
- `twig/lodash-filters` - adds `omit`, `pick`, `filter`, `reject` and `find` filters as in lodash
|
|
79
|
-
|
|
80
|
-
Plugins can be enabled by adding them to the `config/config.js`, eg.
|
|
81
|
-
|
|
82
|
-
```js
|
|
83
|
-
export const plugins = [
|
|
84
|
-
// Enables SASS engine and .sass and .scss file compilation
|
|
85
|
-
require('@videinfra/static-website-builder/plugins/sass'),
|
|
86
|
-
|
|
87
|
-
// Enables TwigJS engine .twig file compilation
|
|
88
|
-
require('@videinfra/static-website-builder/plugins/twig'),
|
|
89
|
-
require('@videinfra/static-website-builder/plugins/twig/symfony-filters'),
|
|
90
|
-
require('@videinfra/static-website-builder/plugins/twig/symfony-functions'),
|
|
91
|
-
require('@videinfra/static-website-builder/plugins/twig/lodash-filters'),
|
|
92
|
-
];
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Wiki
|
|
96
|
-
|
|
97
|
-
See [our wiki](https://github.com/videinfra/static-website-builder/wiki) for additional information.
|
|
98
|
-
|
|
99
|
-
[npm-url]: https://npmjs.org/package/@videinfra/static-website-builder
|
|
100
|
-
[npm-image]: http://img.shields.io/npm/v/@videinfra/static-website-builder.svg
|
|
101
|
-
[travis-url]: https://travis-ci.org/videinfra/static-website-builder
|
|
102
|
-
[travis-image]: https://travis-ci.org/videinfra/static-website-builder.svg?branch=master
|
|
1
|
+
[npm-url]: https://npmjs.org/package/@videinfra/static-website-builder
|
|
2
|
+
[npm-image]: http://img.shields.io/npm/v/@videinfra/static-website-builder.svg
|
|
3
|
+
[travis-url]: https://travis-ci.org/videinfra/static-website-builder
|
|
4
|
+
[travis-image]: https://travis-ci.org/videinfra/static-website-builder.svg?branch=master
|
|
5
|
+
|
|
6
|
+
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]
|
|
7
|
+
|
|
8
|
+
`static-website-builder` is a customizable static site project builder powered by Gulp, Rolldown, SASS, PostCSS, TwigJS, BrowserSync
|
|
9
|
+
|
|
10
|
+
## Requirements
|
|
11
|
+
|
|
12
|
+
- Node.js >= 20.0.0
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- Gulp: built using gulp
|
|
17
|
+
- Built-in Server: Local development server with hot reloading
|
|
18
|
+
- Templates: HTML templates with minification
|
|
19
|
+
- TWIG: Optional TwigJS template engine with optional plugins for additional functions and filters
|
|
20
|
+
- Stylesheets: Autoprefixing and minification with PostCSS support
|
|
21
|
+
- SASS: Optional SASS / SCSS compilation
|
|
22
|
+
- Javascript/Typescript: Transpilation, bundling and minification with rolldown
|
|
23
|
+
- SVG icons: Sprite generation from individual SVG files
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
* Paths: Source and destinations paths are configurable
|
|
27
|
+
* Features: All features can be configured or disabled
|
|
28
|
+
* Plugins: create additional plugins / gulp tasks
|
|
29
|
+
|
|
30
|
+
## Quick start
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
npm init
|
|
34
|
+
npm install @videinfra/static-website-builder --save
|
|
35
|
+
npx builder init
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Start development server
|
|
39
|
+
```
|
|
40
|
+
npm run start
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Build production files
|
|
44
|
+
```
|
|
45
|
+
npm run start
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Note: these commands are added to the project during `npm init`.
|
|
49
|
+
|
|
50
|
+
## Commands
|
|
51
|
+
|
|
52
|
+
### Development server
|
|
53
|
+
|
|
54
|
+
```npx run builder watch```
|
|
55
|
+
|
|
56
|
+
### Generate production ready files
|
|
57
|
+
|
|
58
|
+
```npx run builder build```
|
|
59
|
+
|
|
60
|
+
### List all available tasks
|
|
61
|
+
|
|
62
|
+
```npx run builder --tasks```
|
|
63
|
+
|
|
64
|
+
## Project templates
|
|
65
|
+
|
|
66
|
+
As used in quick start, project templates are used to generate boilerplate / starter files and add commands to the project:
|
|
67
|
+
|
|
68
|
+
- [`default`](https://github.com/videinfra/static-website-builder/tree/master/init/default) - simple template with normalize.scss
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## Plugins
|
|
72
|
+
|
|
73
|
+
Built-in plugins:
|
|
74
|
+
- `sass` - adds `.sass` and `.scss` file rendering using SASS
|
|
75
|
+
- `twig` - adds `.twig` file rendering using TwigJS
|
|
76
|
+
- `twig/symfony-filters` - adds `humanize` filter as found in Symfony
|
|
77
|
+
- `twig/symfony-functions` - adds `asset` function as found in Symfony
|
|
78
|
+
- `twig/lodash-filters` - adds `omit`, `pick`, `filter`, `reject` and `find` filters as in lodash
|
|
79
|
+
|
|
80
|
+
Plugins can be enabled by adding them to the `config/config.js`, eg.
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
export const plugins = [
|
|
84
|
+
// Enables SASS engine and .sass and .scss file compilation
|
|
85
|
+
require('@videinfra/static-website-builder/plugins/sass'),
|
|
86
|
+
|
|
87
|
+
// Enables TwigJS engine .twig file compilation
|
|
88
|
+
require('@videinfra/static-website-builder/plugins/twig'),
|
|
89
|
+
require('@videinfra/static-website-builder/plugins/twig/symfony-filters'),
|
|
90
|
+
require('@videinfra/static-website-builder/plugins/twig/symfony-functions'),
|
|
91
|
+
require('@videinfra/static-website-builder/plugins/twig/lodash-filters'),
|
|
92
|
+
];
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Wiki
|
|
96
|
+
|
|
97
|
+
See [our wiki](https://github.com/videinfra/static-website-builder/wiki) for additional information.
|
|
98
|
+
|
|
99
|
+
[npm-url]: https://npmjs.org/package/@videinfra/static-website-builder
|
|
100
|
+
[npm-image]: http://img.shields.io/npm/v/@videinfra/static-website-builder.svg
|
|
101
|
+
[travis-url]: https://travis-ci.org/videinfra/static-website-builder
|
|
102
|
+
[travis-image]: https://travis-ci.org/videinfra/static-website-builder.svg?branch=master
|
package/bin/builder.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import minimist from 'minimist';
|
|
5
|
-
import { fork } from 'child_process';
|
|
6
|
-
import { createRequire } from 'node:module';
|
|
7
|
-
|
|
8
|
-
const require = createRequire(import.meta.url);
|
|
9
|
-
const allArgs = minimist(process.argv.slice(2));
|
|
10
|
-
const additionalArgs = allArgs._;
|
|
11
|
-
|
|
12
|
-
if (additionalArgs[0] === 'init') {
|
|
13
|
-
import('../init/index').then(({ default: init }) => {
|
|
14
|
-
init(additionalArgs[1]);
|
|
15
|
-
});
|
|
16
|
-
} else {
|
|
17
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
18
|
-
|
|
19
|
-
const builderEntryDir = path.resolve(__dirname, '../gulpfile.js');
|
|
20
|
-
const gulpModulePath = path.dirname(require.resolve('gulp'));
|
|
21
|
-
const gulpBinaryFile = path.join(gulpModulePath, '/bin/gulp');
|
|
22
|
-
|
|
23
|
-
let args = ['--gulpfile', builderEntryDir];
|
|
24
|
-
|
|
25
|
-
if (additionalArgs.length) {
|
|
26
|
-
args = args.concat(additionalArgs);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (allArgs.config) {
|
|
30
|
-
args = args.concat('--config', allArgs.config);
|
|
31
|
-
}
|
|
32
|
-
if (allArgs.tasks) {
|
|
33
|
-
args = args.concat('--tasks', '');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
fork(gulpBinaryFile, args).on('exit', function (code) {
|
|
37
|
-
// Exit with error if child process exited with an error
|
|
38
|
-
process.exit(code);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import minimist from 'minimist';
|
|
5
|
+
import { fork } from 'child_process';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
const allArgs = minimist(process.argv.slice(2));
|
|
10
|
+
const additionalArgs = allArgs._;
|
|
11
|
+
|
|
12
|
+
if (additionalArgs[0] === 'init') {
|
|
13
|
+
import('../init/index').then(({ default: init }) => {
|
|
14
|
+
init(additionalArgs[1]);
|
|
15
|
+
});
|
|
16
|
+
} else {
|
|
17
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
|
|
19
|
+
const builderEntryDir = path.resolve(__dirname, '../gulpfile.js');
|
|
20
|
+
const gulpModulePath = path.dirname(require.resolve('gulp'));
|
|
21
|
+
const gulpBinaryFile = path.join(gulpModulePath, '/bin/gulp');
|
|
22
|
+
|
|
23
|
+
let args = ['--gulpfile', builderEntryDir];
|
|
24
|
+
|
|
25
|
+
if (additionalArgs.length) {
|
|
26
|
+
args = args.concat(additionalArgs);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (allArgs.config) {
|
|
30
|
+
args = args.concat('--config', allArgs.config);
|
|
31
|
+
}
|
|
32
|
+
if (allArgs.tasks) {
|
|
33
|
+
args = args.concat('--tasks', '');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
fork(gulpBinaryFile, args).on('exit', function (code) {
|
|
37
|
+
// Exit with error if child process exited with an error
|
|
38
|
+
process.exit(code);
|
|
39
|
+
});
|
|
40
|
+
}
|
package/eslint.config.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { defineConfig } from "eslint/config";
|
|
2
|
-
|
|
3
|
-
export default defineConfig([
|
|
4
|
-
{
|
|
5
|
-
env: {
|
|
6
|
-
"browser": true,
|
|
7
|
-
"commonjs": true,
|
|
8
|
-
"es6": true,
|
|
9
|
-
"jquery": true
|
|
10
|
-
},
|
|
11
|
-
extends: "eslint:recommended",
|
|
12
|
-
parserOptions: {
|
|
13
|
-
"sourceType": "module"
|
|
14
|
-
},
|
|
15
|
-
rules: {
|
|
16
|
-
"linebreak-style": [
|
|
17
|
-
"error",
|
|
18
|
-
"unix"
|
|
19
|
-
],
|
|
20
|
-
"quotes": [
|
|
21
|
-
"error",
|
|
22
|
-
"single"
|
|
23
|
-
],
|
|
24
|
-
"semi": [
|
|
25
|
-
"error",
|
|
26
|
-
"always"
|
|
27
|
-
],
|
|
28
|
-
"no-console": [
|
|
29
|
-
"warn", { "allow": ["warn", "error"] }
|
|
30
|
-
],
|
|
31
|
-
"no-debugger": [
|
|
32
|
-
"warn"
|
|
33
|
-
],
|
|
34
|
-
"no-unused-vars": [
|
|
35
|
-
"warn"
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
]);
|
|
1
|
+
import { defineConfig } from "eslint/config";
|
|
2
|
+
|
|
3
|
+
export default defineConfig([
|
|
4
|
+
{
|
|
5
|
+
env: {
|
|
6
|
+
"browser": true,
|
|
7
|
+
"commonjs": true,
|
|
8
|
+
"es6": true,
|
|
9
|
+
"jquery": true
|
|
10
|
+
},
|
|
11
|
+
extends: "eslint:recommended",
|
|
12
|
+
parserOptions: {
|
|
13
|
+
"sourceType": "module"
|
|
14
|
+
},
|
|
15
|
+
rules: {
|
|
16
|
+
"linebreak-style": [
|
|
17
|
+
"error",
|
|
18
|
+
"unix"
|
|
19
|
+
],
|
|
20
|
+
"quotes": [
|
|
21
|
+
"error",
|
|
22
|
+
"single"
|
|
23
|
+
],
|
|
24
|
+
"semi": [
|
|
25
|
+
"error",
|
|
26
|
+
"always"
|
|
27
|
+
],
|
|
28
|
+
"no-console": [
|
|
29
|
+
"warn", { "allow": ["warn", "error"] }
|
|
30
|
+
],
|
|
31
|
+
"no-debugger": [
|
|
32
|
+
"warn"
|
|
33
|
+
],
|
|
34
|
+
"no-unused-vars": [
|
|
35
|
+
"warn"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
]);
|
package/gulpfile.js
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { getConfigAsync } from './lib/get-config.js';
|
|
2
|
-
import generateGulpTasks from './lib/generate-gulp-tasks.js';
|
|
3
|
-
|
|
4
|
-
// Set mode globally it can be used by tasks
|
|
5
|
-
let hasProductionArg = false;
|
|
6
|
-
|
|
7
|
-
for (let i = 0; i < process.argv.length; i++) {
|
|
8
|
-
const argValue = process.argv[i];
|
|
9
|
-
// If build task is 'build' or '...-build' then set production mode
|
|
10
|
-
if (argValue === 'build' || argValue.match(/^[a-z0-9-]+-build$/)) {
|
|
11
|
-
hasProductionArg = true;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
global.production = global.production || hasProductionArg || process.env.NODE_ENV === 'production';
|
|
16
|
-
global.development = !global.production;
|
|
17
|
-
|
|
18
|
-
// Config file
|
|
19
|
-
let builderConfigFile = process.env.BUILDER_CONFIG_FILE || 'config/config.js';
|
|
20
|
-
|
|
21
|
-
if (process.argv.indexOf('--config') !== -1) {
|
|
22
|
-
builderConfigFile = process.argv[process.argv.indexOf('--config') + 1];
|
|
23
|
-
} else {
|
|
24
|
-
for (let i = 0; i < process.argv.length; i++) {
|
|
25
|
-
if (process.argv[i].indexOf('--config=') !== -1) {
|
|
26
|
-
builderConfigFile = process.argv[i].substr(9);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Load all config files and generate gulp tasks
|
|
32
|
-
const gulpTasks = generateGulpTasks(await getConfigAsync(builderConfigFile));
|
|
33
|
-
|
|
34
|
-
// Expose main tasks
|
|
35
|
-
export const build = gulpTasks.build;
|
|
36
|
-
export const watch = gulpTasks.watch;
|
|
37
|
-
|
|
38
|
-
// Expose separate tasks
|
|
39
|
-
export const clean = gulpTasks['clean-beforeBuild'];
|
|
40
|
-
|
|
41
|
-
export const fonts = gulpTasks['fonts-build'];
|
|
42
|
-
export const fontsWatch = gulpTasks['fonts-watch'];
|
|
43
|
-
|
|
44
|
-
export const html = gulpTasks['html-build'];
|
|
45
|
-
export const htmlWatch = gulpTasks['html-watch'];
|
|
46
|
-
|
|
47
|
-
export const icons = gulpTasks['icons-build'];
|
|
48
|
-
export const iconsWatch = gulpTasks['icons-watch'];
|
|
49
|
-
|
|
50
|
-
export const images = gulpTasks['images-build'];
|
|
51
|
-
export const imagesWatch = gulpTasks['images-watch'];
|
|
52
|
-
|
|
53
|
-
export const sitemap = gulpTasks['sitemap-afterBuild'];
|
|
54
|
-
export const sitemapWatch = gulpTasks['sitemap-watch'];
|
|
55
|
-
|
|
56
|
-
export const staticFiles = gulpTasks['staticFiles-build'];
|
|
57
|
-
export const staticFilesWatch = gulpTasks['staticFiles-watch'];
|
|
58
|
-
|
|
59
|
-
export const stylesheets = gulpTasks['stylesheets-build'];
|
|
60
|
-
export const stylesheetsWatch = gulpTasks['stylesheets-watch'];
|
|
61
|
-
|
|
62
|
-
export const javascripts = gulpTasks['javascripts-build'];
|
|
63
|
-
export const javascriptsWatch = gulpTasks['javascripts-watch'];
|
|
1
|
+
import { getConfigAsync } from './lib/get-config.js';
|
|
2
|
+
import generateGulpTasks from './lib/generate-gulp-tasks.js';
|
|
3
|
+
|
|
4
|
+
// Set mode globally it can be used by tasks
|
|
5
|
+
let hasProductionArg = false;
|
|
6
|
+
|
|
7
|
+
for (let i = 0; i < process.argv.length; i++) {
|
|
8
|
+
const argValue = process.argv[i];
|
|
9
|
+
// If build task is 'build' or '...-build' then set production mode
|
|
10
|
+
if (argValue === 'build' || argValue.match(/^[a-z0-9-]+-build$/)) {
|
|
11
|
+
hasProductionArg = true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
global.production = global.production || hasProductionArg || process.env.NODE_ENV === 'production';
|
|
16
|
+
global.development = !global.production;
|
|
17
|
+
|
|
18
|
+
// Config file
|
|
19
|
+
let builderConfigFile = process.env.BUILDER_CONFIG_FILE || 'config/config.js';
|
|
20
|
+
|
|
21
|
+
if (process.argv.indexOf('--config') !== -1) {
|
|
22
|
+
builderConfigFile = process.argv[process.argv.indexOf('--config') + 1];
|
|
23
|
+
} else {
|
|
24
|
+
for (let i = 0; i < process.argv.length; i++) {
|
|
25
|
+
if (process.argv[i].indexOf('--config=') !== -1) {
|
|
26
|
+
builderConfigFile = process.argv[i].substr(9);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Load all config files and generate gulp tasks
|
|
32
|
+
const gulpTasks = generateGulpTasks(await getConfigAsync(builderConfigFile));
|
|
33
|
+
|
|
34
|
+
// Expose main tasks
|
|
35
|
+
export const build = gulpTasks.build;
|
|
36
|
+
export const watch = gulpTasks.watch;
|
|
37
|
+
|
|
38
|
+
// Expose separate tasks
|
|
39
|
+
export const clean = gulpTasks['clean-beforeBuild'];
|
|
40
|
+
|
|
41
|
+
export const fonts = gulpTasks['fonts-build'];
|
|
42
|
+
export const fontsWatch = gulpTasks['fonts-watch'];
|
|
43
|
+
|
|
44
|
+
export const html = gulpTasks['html-build'];
|
|
45
|
+
export const htmlWatch = gulpTasks['html-watch'];
|
|
46
|
+
|
|
47
|
+
export const icons = gulpTasks['icons-build'];
|
|
48
|
+
export const iconsWatch = gulpTasks['icons-watch'];
|
|
49
|
+
|
|
50
|
+
export const images = gulpTasks['images-build'];
|
|
51
|
+
export const imagesWatch = gulpTasks['images-watch'];
|
|
52
|
+
|
|
53
|
+
export const sitemap = gulpTasks['sitemap-afterBuild'];
|
|
54
|
+
export const sitemapWatch = gulpTasks['sitemap-watch'];
|
|
55
|
+
|
|
56
|
+
export const staticFiles = gulpTasks['staticFiles-build'];
|
|
57
|
+
export const staticFilesWatch = gulpTasks['staticFiles-watch'];
|
|
58
|
+
|
|
59
|
+
export const stylesheets = gulpTasks['stylesheets-build'];
|
|
60
|
+
export const stylesheetsWatch = gulpTasks['stylesheets-watch'];
|
|
61
|
+
|
|
62
|
+
export const javascripts = gulpTasks['javascripts-build'];
|
|
63
|
+
export const javascriptsWatch = gulpTasks['javascripts-watch'];
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Task configuration
|
|
3
|
-
* All options will be merged with defaults, but not replaces whole configuration object
|
|
4
|
-
*
|
|
5
|
-
* Default configuration can be seen here https://github.com/videinfra/static-website-builder/tree/master/tasks
|
|
6
|
-
* in each tasks config.js file
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import * as sassPlugin from '@videinfra/static-website-builder/plugins/sass';
|
|
10
|
-
import * as twigPlugin from '@videinfra/static-website-builder/plugins/twig';
|
|
11
|
-
|
|
12
|
-
export const clean = {};
|
|
13
|
-
export const staticFiles = {};
|
|
14
|
-
export const html = {};
|
|
15
|
-
export const data = {};
|
|
16
|
-
export const fonts = {};
|
|
17
|
-
export const icons = {};
|
|
18
|
-
export const images = {};
|
|
19
|
-
export const javascripts = {};
|
|
20
|
-
export const stylesheets = {};
|
|
21
|
-
export const browserSync = {};
|
|
22
|
-
export const sizereport = {};
|
|
23
|
-
|
|
24
|
-
export const plugins = [
|
|
25
|
-
// Enables SASS engine and .sass and .scss file compilation
|
|
26
|
-
sassPlugin,
|
|
27
|
-
|
|
28
|
-
// Enables TwigJS engine .twig file compilation
|
|
29
|
-
twigPlugin,
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/*
|
|
34
|
-
* Path configuration
|
|
35
|
-
* All options will be merged with defaults, but not replaces whole configuration object
|
|
36
|
-
*
|
|
37
|
-
* Default configuration can be seen here https://github.com/videinfra/static-website-builder/tree/master/tasks
|
|
38
|
-
* in each tasks config.js file
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
export const paths = {
|
|
42
|
-
src: './src',
|
|
43
|
-
dest: './public',
|
|
44
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
* Task configuration
|
|
3
|
+
* All options will be merged with defaults, but not replaces whole configuration object
|
|
4
|
+
*
|
|
5
|
+
* Default configuration can be seen here https://github.com/videinfra/static-website-builder/tree/master/tasks
|
|
6
|
+
* in each tasks config.js file
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as sassPlugin from '@videinfra/static-website-builder/plugins/sass';
|
|
10
|
+
import * as twigPlugin from '@videinfra/static-website-builder/plugins/twig';
|
|
11
|
+
|
|
12
|
+
export const clean = {};
|
|
13
|
+
export const staticFiles = {};
|
|
14
|
+
export const html = {};
|
|
15
|
+
export const data = {};
|
|
16
|
+
export const fonts = {};
|
|
17
|
+
export const icons = {};
|
|
18
|
+
export const images = {};
|
|
19
|
+
export const javascripts = {};
|
|
20
|
+
export const stylesheets = {};
|
|
21
|
+
export const browserSync = {};
|
|
22
|
+
export const sizereport = {};
|
|
23
|
+
|
|
24
|
+
export const plugins = [
|
|
25
|
+
// Enables SASS engine and .sass and .scss file compilation
|
|
26
|
+
sassPlugin,
|
|
27
|
+
|
|
28
|
+
// Enables TwigJS engine .twig file compilation
|
|
29
|
+
twigPlugin,
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* Path configuration
|
|
35
|
+
* All options will be merged with defaults, but not replaces whole configuration object
|
|
36
|
+
*
|
|
37
|
+
* Default configuration can be seen here https://github.com/videinfra/static-website-builder/tree/master/tasks
|
|
38
|
+
* in each tasks config.js file
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
export const paths = {
|
|
42
|
+
src: './src',
|
|
43
|
+
dest: './public',
|
|
44
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Content exported from this file is avaiable in the templates as variables
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* <div>{{ name }}</div>
|
|
6
|
-
*/
|
|
7
|
-
export default {
|
|
8
|
-
'name': 'World',
|
|
9
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Content exported from this file is avaiable in the templates as variables
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* <div>{{ name }}</div>
|
|
6
|
+
*/
|
|
7
|
+
export default {
|
|
8
|
+
'name': 'World',
|
|
9
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* All files listed in here are created / compiled and additionally
|
|
3
|
-
* shared.js is automatically created, which contains all common JS (chunks / modules imported from more than 1 entry files).
|
|
4
|
-
*/
|
|
5
|
-
export default {
|
|
6
|
-
'main': [
|
|
7
|
-
'./common',
|
|
8
|
-
'./main'
|
|
9
|
-
],
|
|
10
|
-
'dark': [
|
|
11
|
-
'./common',
|
|
12
|
-
'./dark'
|
|
13
|
-
]
|
|
14
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
* All files listed in here are created / compiled and additionally
|
|
3
|
+
* shared.js is automatically created, which contains all common JS (chunks / modules imported from more than 1 entry files).
|
|
4
|
+
*/
|
|
5
|
+
export default {
|
|
6
|
+
'main': [
|
|
7
|
+
'./common',
|
|
8
|
+
'./main'
|
|
9
|
+
],
|
|
10
|
+
'dark': [
|
|
11
|
+
'./common',
|
|
12
|
+
'./dark'
|
|
13
|
+
]
|
|
14
|
+
};
|