@videinfra/static-website-builder 2.0.3 → 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 -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 -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 -26
- package/tasks/env/get-env.js +113 -113
- 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
package/tasks/static/task.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import gulp from 'gulp';
|
|
2
|
-
import nanomemoize from 'nano-memoize';
|
|
3
|
-
|
|
4
|
-
import globs from './../../lib/globs-helper.js';
|
|
5
|
-
import { getDestPath, getSourcePaths } from './../../lib/get-path.js';
|
|
6
|
-
import { getTaskConfig } from './../../lib/get-config.js';
|
|
7
|
-
|
|
8
|
-
import taskStart from '../../lib/gulp/task-start.js';
|
|
9
|
-
import taskEnd from '../../lib/gulp/task-end.js';
|
|
10
|
-
import taskBeforeDest from '../../lib/gulp/task-before-dest.js';
|
|
11
|
-
import taskWatch from '../../lib/gulp/task-watch.js';
|
|
12
|
-
|
|
13
|
-
const getWatchGlobPaths = function (forChokidar = false) {
|
|
14
|
-
const sourcePaths = getSourcePaths('staticFiles');
|
|
15
|
-
const ignore = getTaskConfig('staticFiles', 'ignore');
|
|
16
|
-
|
|
17
|
-
return globs.generate(
|
|
18
|
-
globs.paths(sourcePaths).allFiles(), // Files to watch
|
|
19
|
-
globs.paths(sourcePaths).paths(ignore).ignore(), // List of files which to ignore
|
|
20
|
-
forChokidar,
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
const getGlobPaths = nanomemoize.nanomemoize(function () {
|
|
24
|
-
return getWatchGlobPaths(false);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
function staticFiles() {
|
|
28
|
-
return (
|
|
29
|
-
gulp
|
|
30
|
-
.src(getGlobPaths(), { since: gulp.lastRun(staticFiles) })
|
|
31
|
-
.pipe(taskStart())
|
|
32
|
-
|
|
33
|
-
.pipe(taskBeforeDest())
|
|
34
|
-
.pipe(gulp.dest(getDestPath('staticFiles')))
|
|
35
|
-
|
|
36
|
-
// Reload on change
|
|
37
|
-
.pipe(taskEnd())
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function staticFilesWatch() {
|
|
42
|
-
return taskWatch(getWatchGlobPaths(true), staticFiles);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const build = staticFiles;
|
|
46
|
-
export const watch = staticFilesWatch;
|
|
1
|
+
import gulp from 'gulp';
|
|
2
|
+
import nanomemoize from 'nano-memoize';
|
|
3
|
+
|
|
4
|
+
import globs from './../../lib/globs-helper.js';
|
|
5
|
+
import { getDestPath, getSourcePaths } from './../../lib/get-path.js';
|
|
6
|
+
import { getTaskConfig } from './../../lib/get-config.js';
|
|
7
|
+
|
|
8
|
+
import taskStart from '../../lib/gulp/task-start.js';
|
|
9
|
+
import taskEnd from '../../lib/gulp/task-end.js';
|
|
10
|
+
import taskBeforeDest from '../../lib/gulp/task-before-dest.js';
|
|
11
|
+
import taskWatch from '../../lib/gulp/task-watch.js';
|
|
12
|
+
|
|
13
|
+
const getWatchGlobPaths = function (forChokidar = false) {
|
|
14
|
+
const sourcePaths = getSourcePaths('staticFiles');
|
|
15
|
+
const ignore = getTaskConfig('staticFiles', 'ignore');
|
|
16
|
+
|
|
17
|
+
return globs.generate(
|
|
18
|
+
globs.paths(sourcePaths).allFiles(), // Files to watch
|
|
19
|
+
globs.paths(sourcePaths).paths(ignore).ignore(), // List of files which to ignore
|
|
20
|
+
forChokidar,
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
const getGlobPaths = nanomemoize.nanomemoize(function () {
|
|
24
|
+
return getWatchGlobPaths(false);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
function staticFiles() {
|
|
28
|
+
return (
|
|
29
|
+
gulp
|
|
30
|
+
.src(getGlobPaths(), { since: gulp.lastRun(staticFiles) })
|
|
31
|
+
.pipe(taskStart())
|
|
32
|
+
|
|
33
|
+
.pipe(taskBeforeDest())
|
|
34
|
+
.pipe(gulp.dest(getDestPath('staticFiles')))
|
|
35
|
+
|
|
36
|
+
// Reload on change
|
|
37
|
+
.pipe(taskEnd())
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function staticFilesWatch() {
|
|
42
|
+
return taskWatch(getWatchGlobPaths(true), staticFiles);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const build = staticFiles;
|
|
46
|
+
export const watch = staticFilesWatch;
|
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import * as stylesheetsTask from './task.js';
|
|
2
|
-
import * as preprocessStylesheetsConfig from './preprocess-config.js';
|
|
3
|
-
|
|
4
|
-
export const stylesheets = {
|
|
5
|
-
// Engine is a function which returns a gulp pipe function, eg. sass()
|
|
6
|
-
// Intended to be used by plugins, not manually
|
|
7
|
-
engine: null,
|
|
8
|
-
|
|
9
|
-
// Glob list of files, which to ignore, relative to the stylesheet source folder
|
|
10
|
-
// see https://gulpjs.com/docs/en/getting-started/explaining-globs/
|
|
11
|
-
ignore: [],
|
|
12
|
-
|
|
13
|
-
// File extensions
|
|
14
|
-
extensions: ['css'],
|
|
15
|
-
|
|
16
|
-
// Auto prefixer options
|
|
17
|
-
// see https://github.com/postcss/autoprefixer#options
|
|
18
|
-
autoprefixer: {},
|
|
19
|
-
|
|
20
|
-
// PostCSS Nested Calc
|
|
21
|
-
// see https://www.npmjs.com/package/@csstools/postcss-nested-calc
|
|
22
|
-
nestedCalc: {
|
|
23
|
-
preserve: false,
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
// PostCSS plugins and options
|
|
27
|
-
// see https://github.com/postcss/postcss
|
|
28
|
-
postcss: {
|
|
29
|
-
plugins: [],
|
|
30
|
-
options: {},
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
// Production only settings, overwrites default settings
|
|
34
|
-
production: {
|
|
35
|
-
// Source maps dsabled in production mode
|
|
36
|
-
sourcemaps: false,
|
|
37
|
-
|
|
38
|
-
// Minify CSS in production mode
|
|
39
|
-
// see https://cssnano.co/guides/optimisations
|
|
40
|
-
cssnano: {
|
|
41
|
-
// Preset
|
|
42
|
-
preset: 'default',
|
|
43
|
-
|
|
44
|
-
// Configuration options
|
|
45
|
-
calc: false,
|
|
46
|
-
zindex: false,
|
|
47
|
-
mergeIdents: false,
|
|
48
|
-
reduceIdents: false,
|
|
49
|
-
discardUnused: {
|
|
50
|
-
fontFace: false,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
// Development only settings, overwrites default settings
|
|
56
|
-
development: {
|
|
57
|
-
// Enable source maps in development mode
|
|
58
|
-
// See https://www.npmjs.com/package/gulp-sourcemaps
|
|
59
|
-
sourcemaps: {
|
|
60
|
-
init: {},
|
|
61
|
-
write: {},
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
// Minification disabled in development mode
|
|
65
|
-
cssnano: false,
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const preprocess = {
|
|
70
|
-
stylesheets: [preprocessStylesheetsConfig],
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const tasks = {
|
|
74
|
-
stylesheets: [stylesheetsTask],
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Paths relative to the global src and dest folders
|
|
79
|
-
*/
|
|
80
|
-
export const paths = {
|
|
81
|
-
stylesheets: {
|
|
82
|
-
src: 'stylesheets',
|
|
83
|
-
dest: 'assets/stylesheets',
|
|
84
|
-
},
|
|
85
|
-
};
|
|
1
|
+
import * as stylesheetsTask from './task.js';
|
|
2
|
+
import * as preprocessStylesheetsConfig from './preprocess-config.js';
|
|
3
|
+
|
|
4
|
+
export const stylesheets = {
|
|
5
|
+
// Engine is a function which returns a gulp pipe function, eg. sass()
|
|
6
|
+
// Intended to be used by plugins, not manually
|
|
7
|
+
engine: null,
|
|
8
|
+
|
|
9
|
+
// Glob list of files, which to ignore, relative to the stylesheet source folder
|
|
10
|
+
// see https://gulpjs.com/docs/en/getting-started/explaining-globs/
|
|
11
|
+
ignore: [],
|
|
12
|
+
|
|
13
|
+
// File extensions
|
|
14
|
+
extensions: ['css'],
|
|
15
|
+
|
|
16
|
+
// Auto prefixer options
|
|
17
|
+
// see https://github.com/postcss/autoprefixer#options
|
|
18
|
+
autoprefixer: {},
|
|
19
|
+
|
|
20
|
+
// PostCSS Nested Calc
|
|
21
|
+
// see https://www.npmjs.com/package/@csstools/postcss-nested-calc
|
|
22
|
+
nestedCalc: {
|
|
23
|
+
preserve: false,
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
// PostCSS plugins and options
|
|
27
|
+
// see https://github.com/postcss/postcss
|
|
28
|
+
postcss: {
|
|
29
|
+
plugins: [],
|
|
30
|
+
options: {},
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
// Production only settings, overwrites default settings
|
|
34
|
+
production: {
|
|
35
|
+
// Source maps dsabled in production mode
|
|
36
|
+
sourcemaps: false,
|
|
37
|
+
|
|
38
|
+
// Minify CSS in production mode
|
|
39
|
+
// see https://cssnano.co/guides/optimisations
|
|
40
|
+
cssnano: {
|
|
41
|
+
// Preset
|
|
42
|
+
preset: 'default',
|
|
43
|
+
|
|
44
|
+
// Configuration options
|
|
45
|
+
calc: false,
|
|
46
|
+
zindex: false,
|
|
47
|
+
mergeIdents: false,
|
|
48
|
+
reduceIdents: false,
|
|
49
|
+
discardUnused: {
|
|
50
|
+
fontFace: false,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
// Development only settings, overwrites default settings
|
|
56
|
+
development: {
|
|
57
|
+
// Enable source maps in development mode
|
|
58
|
+
// See https://www.npmjs.com/package/gulp-sourcemaps
|
|
59
|
+
sourcemaps: {
|
|
60
|
+
init: {},
|
|
61
|
+
write: {},
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
// Minification disabled in development mode
|
|
65
|
+
cssnano: false,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const preprocess = {
|
|
70
|
+
stylesheets: [preprocessStylesheetsConfig],
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const tasks = {
|
|
74
|
+
stylesheets: [stylesheetsTask],
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Paths relative to the global src and dest folders
|
|
79
|
+
*/
|
|
80
|
+
export const paths = {
|
|
81
|
+
stylesheets: {
|
|
82
|
+
src: 'stylesheets',
|
|
83
|
+
dest: 'assets/stylesheets',
|
|
84
|
+
},
|
|
85
|
+
};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import cssnano from 'cssnano';
|
|
2
|
-
import autoprefixer from 'autoprefixer';
|
|
3
|
-
import postcssNestedCalc from '@csstools/postcss-nested-calc';
|
|
4
|
-
import find from 'lodash/find.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Modify configuration
|
|
8
|
-
*
|
|
9
|
-
* @param {object} config Stylesheet configuration
|
|
10
|
-
* @param {object} fullConfig Full configuration
|
|
11
|
-
* @returns {object} Transformed stylesheet configuration
|
|
12
|
-
*/
|
|
13
|
-
export default function processStylesheetsConfig (config, fullConfig) {
|
|
14
|
-
if (config && config.cssnano) {
|
|
15
|
-
// Autoprefixer ir running separatelly in postcss
|
|
16
|
-
config.cssnano.autoprefixer = false;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (config && config.postcss) {
|
|
20
|
-
config.postcss.plugins = config.postcss.plugins || [];
|
|
21
|
-
|
|
22
|
-
// Add nestedCalc
|
|
23
|
-
if (config.nestedCalc) {
|
|
24
|
-
config.postcss.plugins.push(postcssNestedCalc(config.nestedCalc));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Add autoprefixer
|
|
28
|
-
if (config.autoprefixer && !find(config.postcss.plugins, {'postcssPlugin': 'autoprefixer'})) {
|
|
29
|
-
config.postcss.plugins.push(autoprefixer(config.autoprefixer));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// // Add CSS nano
|
|
33
|
-
if (config.cssnano && !find(config.postcss.plugins, {'postcssPlugin': 'cssnano'})) {
|
|
34
|
-
config.postcss.plugins.push(cssnano({
|
|
35
|
-
preset: [config.cssnano.preset, config.cssnano]
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return config;
|
|
41
|
-
}
|
|
1
|
+
import cssnano from 'cssnano';
|
|
2
|
+
import autoprefixer from 'autoprefixer';
|
|
3
|
+
import postcssNestedCalc from '@csstools/postcss-nested-calc';
|
|
4
|
+
import find from 'lodash/find.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Modify configuration
|
|
8
|
+
*
|
|
9
|
+
* @param {object} config Stylesheet configuration
|
|
10
|
+
* @param {object} fullConfig Full configuration
|
|
11
|
+
* @returns {object} Transformed stylesheet configuration
|
|
12
|
+
*/
|
|
13
|
+
export default function processStylesheetsConfig (config, fullConfig) {
|
|
14
|
+
if (config && config.cssnano) {
|
|
15
|
+
// Autoprefixer ir running separatelly in postcss
|
|
16
|
+
config.cssnano.autoprefixer = false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (config && config.postcss) {
|
|
20
|
+
config.postcss.plugins = config.postcss.plugins || [];
|
|
21
|
+
|
|
22
|
+
// Add nestedCalc
|
|
23
|
+
if (config.nestedCalc) {
|
|
24
|
+
config.postcss.plugins.push(postcssNestedCalc(config.nestedCalc));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Add autoprefixer
|
|
28
|
+
if (config.autoprefixer && !find(config.postcss.plugins, {'postcssPlugin': 'autoprefixer'})) {
|
|
29
|
+
config.postcss.plugins.push(autoprefixer(config.autoprefixer));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// // Add CSS nano
|
|
33
|
+
if (config.cssnano && !find(config.postcss.plugins, {'postcssPlugin': 'cssnano'})) {
|
|
34
|
+
config.postcss.plugins.push(cssnano({
|
|
35
|
+
preset: [config.cssnano.preset, config.cssnano]
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return config;
|
|
41
|
+
}
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import gulp from 'gulp';
|
|
2
|
-
import gulpif from 'gulp-if';
|
|
3
|
-
import postcss from 'gulp-postcss';
|
|
4
|
-
import sourcemaps from 'gulp-sourcemaps';
|
|
5
|
-
import nanomemoize from 'nano-memoize';
|
|
6
|
-
import cached from 'gulp-cached';
|
|
7
|
-
import dependents from 'gulp-dependents';
|
|
8
|
-
|
|
9
|
-
import globs from './../../lib/globs-helper.js';
|
|
10
|
-
import { getDestPath, getSourcePaths } from '../../lib/get-path.js';
|
|
11
|
-
import { getTaskConfig } from '../../lib/get-config.js';
|
|
12
|
-
|
|
13
|
-
import taskStart from '../../lib/gulp/task-start.js';
|
|
14
|
-
import taskEnd from '../../lib/gulp/task-end.js';
|
|
15
|
-
import taskBeforeDest from '../../lib/gulp/task-before-dest.js';
|
|
16
|
-
import taskWatch from '../../lib/gulp/task-watch.js';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const getWatchGlobPaths = function (forChokidar = false) {
|
|
20
|
-
const sourcePaths = getSourcePaths('stylesheets');
|
|
21
|
-
const extensions = getTaskConfig('stylesheets', 'extensions');
|
|
22
|
-
const ignore = getTaskConfig('stylesheets', 'ignore');
|
|
23
|
-
|
|
24
|
-
return globs.generate(
|
|
25
|
-
globs.paths(sourcePaths).filesWithExtensions(extensions), // Files to watch
|
|
26
|
-
globs.paths(sourcePaths).paths(ignore).ignore(), // List of files which to ignore
|
|
27
|
-
forChokidar,
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const getGlobPaths = nanomemoize.nanomemoize(function () {
|
|
32
|
-
return getWatchGlobPaths(false);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const getEngine = function () {
|
|
37
|
-
const engine = getTaskConfig('stylesheets', 'engine');
|
|
38
|
-
return engine ? engine() : (() => {});
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
function stylesheets () {
|
|
43
|
-
return gulp.src(getGlobPaths())
|
|
44
|
-
.pipe(taskStart())
|
|
45
|
-
|
|
46
|
-
// Faster incremental builds, skip files which didn't changed or their dependencies didn't changed
|
|
47
|
-
.pipe(gulpif(!!getTaskConfig('stylesheets', 'dependents'), cached('stylesheets')))
|
|
48
|
-
.pipe(gulpif(!!getTaskConfig('stylesheets', 'dependents'), dependents(getTaskConfig('dependents'))))
|
|
49
|
-
|
|
50
|
-
.pipe(gulpif(!!getTaskConfig('stylesheets', 'sourcemaps'), sourcemaps.init(getTaskConfig('stylesheets', 'sourcemaps', 'init')))) // Start Sourcemaps
|
|
51
|
-
|
|
52
|
-
// Engine
|
|
53
|
-
.pipe(gulpif(!!getTaskConfig('stylesheets', 'engine'), getEngine()))
|
|
54
|
-
|
|
55
|
-
// Autoprefixer, postcss
|
|
56
|
-
.pipe(gulpif(!!getTaskConfig('stylesheets', 'postcss'), postcss(getTaskConfig('stylesheets', 'postcss', 'plugins'), getTaskConfig('stylesheets', 'postcss', 'options'))))
|
|
57
|
-
|
|
58
|
-
.pipe(gulpif(!!getTaskConfig('stylesheets', 'sourcemaps'), sourcemaps.write('.', getTaskConfig('stylesheets', 'sourcemaps', 'write'))))
|
|
59
|
-
|
|
60
|
-
.pipe(taskBeforeDest())
|
|
61
|
-
.pipe(gulp.dest(getDestPath('stylesheets')))
|
|
62
|
-
|
|
63
|
-
// Reload on change
|
|
64
|
-
.pipe(taskEnd());
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function stylesheetsWatch () {
|
|
68
|
-
return taskWatch(getWatchGlobPaths(true), stylesheets);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export const build = stylesheets;
|
|
73
|
-
export const watch = stylesheetsWatch;
|
|
1
|
+
import gulp from 'gulp';
|
|
2
|
+
import gulpif from 'gulp-if';
|
|
3
|
+
import postcss from 'gulp-postcss';
|
|
4
|
+
import sourcemaps from 'gulp-sourcemaps';
|
|
5
|
+
import nanomemoize from 'nano-memoize';
|
|
6
|
+
import cached from 'gulp-cached';
|
|
7
|
+
import dependents from 'gulp-dependents';
|
|
8
|
+
|
|
9
|
+
import globs from './../../lib/globs-helper.js';
|
|
10
|
+
import { getDestPath, getSourcePaths } from '../../lib/get-path.js';
|
|
11
|
+
import { getTaskConfig } from '../../lib/get-config.js';
|
|
12
|
+
|
|
13
|
+
import taskStart from '../../lib/gulp/task-start.js';
|
|
14
|
+
import taskEnd from '../../lib/gulp/task-end.js';
|
|
15
|
+
import taskBeforeDest from '../../lib/gulp/task-before-dest.js';
|
|
16
|
+
import taskWatch from '../../lib/gulp/task-watch.js';
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const getWatchGlobPaths = function (forChokidar = false) {
|
|
20
|
+
const sourcePaths = getSourcePaths('stylesheets');
|
|
21
|
+
const extensions = getTaskConfig('stylesheets', 'extensions');
|
|
22
|
+
const ignore = getTaskConfig('stylesheets', 'ignore');
|
|
23
|
+
|
|
24
|
+
return globs.generate(
|
|
25
|
+
globs.paths(sourcePaths).filesWithExtensions(extensions), // Files to watch
|
|
26
|
+
globs.paths(sourcePaths).paths(ignore).ignore(), // List of files which to ignore
|
|
27
|
+
forChokidar,
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getGlobPaths = nanomemoize.nanomemoize(function () {
|
|
32
|
+
return getWatchGlobPaths(false);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
const getEngine = function () {
|
|
37
|
+
const engine = getTaskConfig('stylesheets', 'engine');
|
|
38
|
+
return engine ? engine() : (() => {});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
function stylesheets () {
|
|
43
|
+
return gulp.src(getGlobPaths())
|
|
44
|
+
.pipe(taskStart())
|
|
45
|
+
|
|
46
|
+
// Faster incremental builds, skip files which didn't changed or their dependencies didn't changed
|
|
47
|
+
.pipe(gulpif(!!getTaskConfig('stylesheets', 'dependents'), cached('stylesheets')))
|
|
48
|
+
.pipe(gulpif(!!getTaskConfig('stylesheets', 'dependents'), dependents(getTaskConfig('dependents'))))
|
|
49
|
+
|
|
50
|
+
.pipe(gulpif(!!getTaskConfig('stylesheets', 'sourcemaps'), sourcemaps.init(getTaskConfig('stylesheets', 'sourcemaps', 'init')))) // Start Sourcemaps
|
|
51
|
+
|
|
52
|
+
// Engine
|
|
53
|
+
.pipe(gulpif(!!getTaskConfig('stylesheets', 'engine'), getEngine()))
|
|
54
|
+
|
|
55
|
+
// Autoprefixer, postcss
|
|
56
|
+
.pipe(gulpif(!!getTaskConfig('stylesheets', 'postcss'), postcss(getTaskConfig('stylesheets', 'postcss', 'plugins'), getTaskConfig('stylesheets', 'postcss', 'options'))))
|
|
57
|
+
|
|
58
|
+
.pipe(gulpif(!!getTaskConfig('stylesheets', 'sourcemaps'), sourcemaps.write('.', getTaskConfig('stylesheets', 'sourcemaps', 'write'))))
|
|
59
|
+
|
|
60
|
+
.pipe(taskBeforeDest())
|
|
61
|
+
.pipe(gulp.dest(getDestPath('stylesheets')))
|
|
62
|
+
|
|
63
|
+
// Reload on change
|
|
64
|
+
.pipe(taskEnd());
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function stylesheetsWatch () {
|
|
68
|
+
return taskWatch(getWatchGlobPaths(true), stylesheets);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
export const build = stylesheets;
|
|
73
|
+
export const watch = stylesheetsWatch;
|