@ui5/webcomponents-tools 0.0.0-cb061e041 → 0.0.0-cddf8ba1c
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 +375 -0
- package/README.md +2 -1
- package/assets-meta.js +16 -7
- package/components-package/eslint.js +1 -0
- package/components-package/nps.js +34 -29
- package/components-package/postcss.components.js +1 -21
- package/components-package/postcss.themes.js +1 -26
- package/components-package/wdio.js +15 -3
- package/components-package/wdio.sync.js +9 -1
- package/icons-collection/nps.js +8 -6
- package/lib/create-illustrations/index.js +14 -0
- package/lib/create-new-component/index.js +1 -1
- package/lib/css-processors/css-processor-components.mjs +77 -0
- package/lib/css-processors/css-processor-themes.mjs +79 -0
- package/lib/css-processors/scope-variables.mjs +46 -0
- package/lib/{postcss-css-to-esm/index.js → css-processors/shared.mjs} +36 -50
- package/lib/dev-server/custom-hot-update-plugin.js +39 -0
- package/lib/esm-abs-to-rel/index.js +4 -1
- package/lib/generate-custom-elements-manifest/index.js +1 -1
- package/lib/generate-js-imports/illustrations.js +78 -64
- package/lib/generate-json-imports/i18n.js +10 -5
- package/lib/generate-json-imports/themes.js +10 -5
- package/lib/jsdoc/preprocess.js +1 -1
- package/lib/postcss-combine-duplicated-selectors/index.js +12 -5
- package/lib/scoping/get-all-tags.js +1 -1
- package/lib/scoping/scope-test-pages.js +2 -1
- package/package.json +6 -9
- package/lib/postcss-css-to-json/index.js +0 -47
- package/lib/postcss-new-files/index.js +0 -36
- package/lib/postcss-p/postcss-p.mjs +0 -14
@@ -1,72 +1,86 @@
|
|
1
1
|
const fs = require("fs").promises;
|
2
|
-
const path = require(
|
3
|
-
|
4
|
-
const
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
2
|
+
const path = require("path");
|
3
|
+
|
4
|
+
const generateDynamicImportLines = async (fileNames, location, exclusionPatterns = []) => {
|
5
|
+
const packageName = JSON.parse(await fs.readFile("package.json")).name;
|
6
|
+
return fileNames
|
7
|
+
.filter((fileName) => !exclusionPatterns.some((pattern) => fileName.startsWith(pattern)))
|
8
|
+
.map((fileName) => {
|
9
|
+
const illustrationName = fileName.replace(".js", "");
|
10
|
+
const illustrationPath = `${location}/${illustrationName}`;
|
11
|
+
return `\t\tcase "${fileName.replace('.js', '')}": return (await import(/* webpackChunkName: "${packageName.replace("@", "").replace("/", "-")}-${illustrationName.toLowerCase()}" */ "${illustrationPath}.js")).default;`;
|
12
|
+
})
|
13
|
+
.join("\n");
|
14
|
+
};
|
15
|
+
|
16
|
+
const generateAvailableIllustrationsArray = (fileNames, exclusionPatterns = []) => {
|
17
|
+
return JSON.stringify(
|
18
|
+
fileNames
|
19
|
+
.filter((fileName) => !exclusionPatterns.some((pattern) => fileName.startsWith(pattern)))
|
20
|
+
.map((fileName) => fileName.replace(".js", ""))
|
21
|
+
);
|
22
|
+
};
|
23
|
+
|
24
|
+
const generateDynamicImportsFileContent = (dynamicImports, availableIllustrations, collection, prefix = "") => {
|
25
|
+
return `// @ts-nocheck
|
26
|
+
import { registerIllustrationLoader } from "@ui5/webcomponents-base/dist/asset-registries/Illustrations.js";
|
27
|
+
|
28
|
+
export const loadIllustration = async (illustrationName) => {
|
29
|
+
const collectionAndPrefix = "${collection}/${prefix}";
|
30
|
+
const cleanIllustrationName = illustrationName.startsWith(collectionAndPrefix) ? illustrationName.replace(collectionAndPrefix, "") : illustrationName;
|
31
|
+
switch (cleanIllustrationName) {
|
32
|
+
${dynamicImports}
|
33
|
+
default:
|
34
|
+
throw new Error("[Illustrations] Illustration not found: " + illustrationName);
|
35
|
+
}
|
36
|
+
};
|
37
|
+
|
38
|
+
const loadAndCheck = async (illustrationName) => {
|
39
|
+
const data = await loadIllustration(illustrationName);
|
40
|
+
return data;
|
41
|
+
};
|
42
|
+
|
43
|
+
${availableIllustrations}.forEach((illustrationName) =>
|
44
|
+
registerIllustrationLoader(\`${collection}/${prefix}\${illustrationName}\`, loadAndCheck)
|
45
|
+
);
|
46
|
+
`;
|
47
|
+
};
|
48
|
+
|
49
|
+
const getMatchingFiles = async (folder, pattern) => {
|
50
|
+
const dir = await fs.readdir(folder);
|
51
|
+
return dir.filter((fileName) => fileName.match(pattern));
|
51
52
|
};
|
52
|
-
const loadAndCheck = async (illustrationName) => {
|
53
|
-
const data = await loadIllustration(illustrationName);
|
54
|
-
return data;
|
55
|
-
}
|
56
53
|
|
54
|
+
const generateIllustrations = async (config) => {
|
55
|
+
const { inputFolder, outputFile, collection, location, prefix, filterOut } = config;
|
56
|
+
|
57
|
+
const normalizedInputFolder = path.normalize(inputFolder);
|
58
|
+
const normalizedOutputFile = path.normalize(outputFile);
|
59
|
+
|
60
|
+
const illustrations = await getMatchingFiles(normalizedInputFolder, /^.*\.js$/);
|
57
61
|
|
58
|
-
|
59
|
-
|
60
|
-
|
62
|
+
const dynamicImports = await generateDynamicImportLines(illustrations, location, filterOut);
|
63
|
+
const availableIllustrations = generateAvailableIllustrationsArray(illustrations, filterOut);
|
64
|
+
|
65
|
+
const contentDynamic = generateDynamicImportsFileContent(dynamicImports, availableIllustrations, collection, prefix);
|
66
|
+
|
67
|
+
await fs.mkdir(path.dirname(normalizedOutputFile), { recursive: true });
|
68
|
+
await fs.writeFile(normalizedOutputFile, contentDynamic);
|
69
|
+
|
70
|
+
console.log(`Generated ${normalizedOutputFile}`);
|
71
|
+
};
|
61
72
|
|
62
|
-
|
63
|
-
|
73
|
+
// Parse configuration from command-line arguments
|
74
|
+
const config = {
|
75
|
+
inputFolder: process.argv[2],
|
76
|
+
outputFile: process.argv[3],
|
77
|
+
collection: process.argv[4],
|
78
|
+
location: process.argv[5],
|
79
|
+
prefix: process.argv[6],
|
80
|
+
filterOut: process.argv.slice(7),
|
64
81
|
};
|
65
82
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
.catch(err => {
|
70
|
-
console.error(err);
|
71
|
-
process.exit(1);
|
83
|
+
// Run the generation process
|
84
|
+
generateIllustrations(config).catch((error) => {
|
85
|
+
console.error("Error generating illustrations:", error);
|
72
86
|
});
|
@@ -1,13 +1,16 @@
|
|
1
1
|
const fs = require("fs").promises;
|
2
2
|
const path = require('path');
|
3
3
|
|
4
|
+
const isTypeScript = process.env.UI5_TS;
|
5
|
+
const ext = isTypeScript ? 'ts' : 'js';
|
6
|
+
|
4
7
|
const generate = async () => {
|
5
8
|
|
6
9
|
const packageName = JSON.parse(await fs.readFile("package.json")).name;
|
7
10
|
|
8
11
|
const inputFolder = path.normalize(process.argv[2]);
|
9
|
-
const outputFile = path.normalize(`${process.argv[3]}/i18n-static
|
10
|
-
const outputFileDynamic = path.normalize(`${process.argv[3]}/i18n
|
12
|
+
const outputFile = path.normalize(`${process.argv[3]}/i18n-static.${ext}`);
|
13
|
+
const outputFileDynamic = path.normalize(`${process.argv[3]}/i18n.${ext}`);
|
11
14
|
|
12
15
|
// All languages present in the file system
|
13
16
|
const files = await fs.readdir(inputFolder);
|
@@ -32,7 +35,8 @@ const generate = async () => {
|
|
32
35
|
const assetsImportsString = languages.map(key => `import _${key} from "../assets/i18n/messagebundle_${key}.json";`).join("\n");
|
33
36
|
|
34
37
|
// static imports
|
35
|
-
contentStatic =
|
38
|
+
contentStatic = `// @ts-nocheck
|
39
|
+
import { registerI18nLoader } from "@ui5/webcomponents-base/dist/asset-registries/i18n.js";
|
36
40
|
|
37
41
|
${assetsImportsString}
|
38
42
|
|
@@ -56,10 +60,11 @@ localeIds.forEach(localeId => {
|
|
56
60
|
`;
|
57
61
|
|
58
62
|
// Actual imports for json assets
|
59
|
-
const dynamicImportsString = languages.map(key => ` case "${key}": return (await import("../assets/i18n/messagebundle_${key}.json")).default;`).join("\n");
|
63
|
+
const dynamicImportsString = languages.map(key => ` case "${key}": return (await import(/* webpackChunkName: "${packageName.replace("@", "").replace("/", "-")}-messagebundle-${key}" */ "../assets/i18n/messagebundle_${key}.json")).default;`).join("\n");
|
60
64
|
|
61
65
|
// Resulting file content
|
62
|
-
contentDynamic =
|
66
|
+
contentDynamic = `// @ts-nocheck
|
67
|
+
import { registerI18nLoader } from "@ui5/webcomponents-base/dist/asset-registries/i18n.js";
|
63
68
|
|
64
69
|
const importMessageBundle = async (localeId) => {
|
65
70
|
switch (localeId) {
|
@@ -2,10 +2,13 @@ const fs = require("fs").promises;
|
|
2
2
|
const path = require('path');
|
3
3
|
const assets = require("../../assets-meta.js");
|
4
4
|
|
5
|
+
const isTypeScript = process.env.UI5_TS;
|
6
|
+
const ext = isTypeScript ? 'ts' : 'js';
|
7
|
+
|
5
8
|
const generate = async () => {
|
6
9
|
const inputFolder = path.normalize(process.argv[2]);
|
7
|
-
const outputFile = path.normalize(`${process.argv[3]}/Themes-static
|
8
|
-
const outputFileDynamic = path.normalize(`${process.argv[3]}/Themes
|
10
|
+
const outputFile = path.normalize(`${process.argv[3]}/Themes-static.${ext}`);
|
11
|
+
const outputFileDynamic = path.normalize(`${process.argv[3]}/Themes.${ext}`);
|
9
12
|
|
10
13
|
// All supported optional themes
|
11
14
|
const allThemes = assets.themes.all;
|
@@ -22,11 +25,12 @@ const generate = async () => {
|
|
22
25
|
const importLines = themesOnFileSystem.map(theme => `import ${theme} from "../assets/themes/${theme}/parameters-bundle.css.json";`).join("\n");
|
23
26
|
const themeUrlsByName = "{\n" + themesOnFileSystem.join(",\n") + "\n}";
|
24
27
|
const availableThemesArray = `[${themesOnFileSystem.map(theme => `"${theme}"`).join(", ")}]`;
|
25
|
-
const dynamicImportLines = themesOnFileSystem.map(theme => `\t\tcase "${theme}": return (await import("../assets/themes/${theme}/parameters-bundle.css.json")).default;`).join("\n");
|
28
|
+
const dynamicImportLines = themesOnFileSystem.map(theme => `\t\tcase "${theme}": return (await import(/* webpackChunkName: "${packageName.replace("@", "").replace("/", "-")}-${theme.replace("_", "-")}-parameters-bundle" */"../assets/themes/${theme}/parameters-bundle.css.json")).default;`).join("\n");
|
26
29
|
|
27
30
|
|
28
31
|
// static imports file content
|
29
|
-
const contentStatic =
|
32
|
+
const contentStatic = `// @ts-nocheck
|
33
|
+
import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
|
30
34
|
|
31
35
|
${importLines}
|
32
36
|
|
@@ -47,7 +51,8 @@ ${availableThemesArray}
|
|
47
51
|
|
48
52
|
|
49
53
|
// dynamic imports file content
|
50
|
-
const contentDynamic =
|
54
|
+
const contentDynamic = `// @ts-nocheck
|
55
|
+
import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
|
51
56
|
|
52
57
|
const loadThemeProperties = async (themeName) => {
|
53
58
|
switch (themeName) {
|
package/lib/jsdoc/preprocess.js
CHANGED
@@ -116,7 +116,7 @@ const processComponentFile = async (fileName) => {
|
|
116
116
|
const destFileName = fileName.replace(sourceDir, inputDir).replace(/\.ts$/, ".js");
|
117
117
|
let jsFileContent = `${await fs.readFile(destFileName)}`;
|
118
118
|
|
119
|
-
const classDefinitionRegExp = new RegExp(`let.*? = class`, "gm");
|
119
|
+
const classDefinitionRegExp = new RegExp(`(let.*? = class)|(^class.*?)`, "gm");
|
120
120
|
let classDefinitionMatch = jsFileContent.match(classDefinitionRegExp);
|
121
121
|
if (!classDefinitionMatch) {
|
122
122
|
return; // not a file, generated by typescript, nothing to do here
|
@@ -154,22 +154,29 @@ module.exports = (options) => {
|
|
154
154
|
options.removeDuplicatedProperties ||
|
155
155
|
options.removeDuplicatedValues
|
156
156
|
) {
|
157
|
-
removeDupProperties(
|
158
|
-
|
159
|
-
|
160
|
-
);
|
157
|
+
// removeDupProperties(
|
158
|
+
// destination,
|
159
|
+
// options.removeDuplicatedValues,
|
160
|
+
// );
|
161
161
|
}
|
162
162
|
} else {
|
163
163
|
if (
|
164
164
|
options.removeDuplicatedProperties ||
|
165
165
|
options.removeDuplicatedValues
|
166
166
|
) {
|
167
|
-
removeDupProperties(rule, options.removeDuplicatedValues);
|
167
|
+
// removeDupProperties(rule, options.removeDuplicatedValues);
|
168
168
|
}
|
169
169
|
// add new selector to symbol table
|
170
170
|
map.set(selector, rule);
|
171
171
|
}
|
172
172
|
},
|
173
|
+
OnceExit(root) {
|
174
|
+
root.nodes.forEach(node => {
|
175
|
+
if (node.type === "rule") {
|
176
|
+
removeDupProperties(node, options.removeDuplicatedValues);
|
177
|
+
}
|
178
|
+
})
|
179
|
+
}
|
173
180
|
};
|
174
181
|
},
|
175
182
|
};
|
@@ -10,7 +10,7 @@ const getTag = file => {
|
|
10
10
|
|
11
11
|
const getPackageTags = (packageDir) => {
|
12
12
|
const srcDir = path.join(packageDir, "src/");
|
13
|
-
return glob.sync(path.join(srcDir, "/**/*.
|
13
|
+
return glob.sync(path.join(srcDir, "/**/*.ts")).flatMap(file => {
|
14
14
|
const tag = getTag(file);
|
15
15
|
return [tag];
|
16
16
|
}).filter(item => !!item);
|
@@ -18,6 +18,7 @@ const replaceTagsHTML = content => {
|
|
18
18
|
|
19
19
|
// Replace tags in any content
|
20
20
|
const replaceTagsAny = content => {
|
21
|
+
console.log(tags.length);
|
21
22
|
tags.forEach(tag => {
|
22
23
|
content = content.replace(new RegExp(`(^|[^\-_A-Za-z0-9])(${tag})([^\-_A-Za-z0-9]|$)`, "g"), `$1$2-${suffix}$3`);
|
23
24
|
});
|
@@ -27,7 +28,7 @@ const replaceTagsAny = content => {
|
|
27
28
|
// Replace bundle names and HTML tag names in test pages
|
28
29
|
glob.sync(path.join(root, "/**/*.html")).forEach(file => {
|
29
30
|
let content = String(fs.readFileSync(file));
|
30
|
-
content = content.replace(
|
31
|
+
content = content.replace("%VITE_BUNDLE_PATH%", "%VITE_BUNDLE_PATH_SCOPED%");
|
31
32
|
content = replaceTagsHTML(content);
|
32
33
|
fs.writeFileSync(file, content);
|
33
34
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-cddf8ba1c",
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -21,10 +21,9 @@
|
|
21
21
|
"directory": "packages/tools"
|
22
22
|
},
|
23
23
|
"dependencies": {
|
24
|
-
"@typescript-eslint/eslint-plugin": "^
|
25
|
-
"@typescript-eslint/parser": "^
|
24
|
+
"@typescript-eslint/eslint-plugin": "^6.9.0",
|
25
|
+
"@typescript-eslint/parser": "^6.9.0",
|
26
26
|
"@wdio/cli": "^7.19.7",
|
27
|
-
"@wdio/devtools-service": "^7.19.7",
|
28
27
|
"@wdio/dot-reporter": "^7.19.7",
|
29
28
|
"@wdio/local-runner": "^7.19.7",
|
30
29
|
"@wdio/mocha-framework": "^7.19.7",
|
@@ -37,7 +36,6 @@
|
|
37
36
|
"command-line-args": "^5.1.1",
|
38
37
|
"concurrently": "^6.0.0",
|
39
38
|
"cross-env": "^7.0.3",
|
40
|
-
"cssnano": "^4.1.11",
|
41
39
|
"escodegen": "^2.0.0",
|
42
40
|
"eslint": "^7.22.0",
|
43
41
|
"eslint-config-airbnb-base": "^14.2.1",
|
@@ -55,7 +53,6 @@
|
|
55
53
|
"nps": "^5.10.0",
|
56
54
|
"postcss": "^8.4.5",
|
57
55
|
"postcss-cli": "^9.1.0",
|
58
|
-
"postcss-import": "^14.0.2",
|
59
56
|
"postcss-selector-parser": "^6.0.10",
|
60
57
|
"prompts": "^2.4.2",
|
61
58
|
"properties-reader": "^2.2.0",
|
@@ -63,9 +60,8 @@
|
|
63
60
|
"resolve": "^1.20.0",
|
64
61
|
"rimraf": "^3.0.2",
|
65
62
|
"slash": "3.0.0",
|
66
|
-
"vite": "^
|
67
|
-
"wdio-chromedriver-service": "^7.3.2"
|
68
|
-
"zx": "^4.3.0"
|
63
|
+
"vite": "^4.4.9",
|
64
|
+
"wdio-chromedriver-service": "^7.3.2"
|
69
65
|
},
|
70
66
|
"peerDependencies": {
|
71
67
|
"chromedriver": "*",
|
@@ -77,6 +73,7 @@
|
|
77
73
|
}
|
78
74
|
},
|
79
75
|
"devDependencies": {
|
76
|
+
"esbuild": "^0.19.9",
|
80
77
|
"yargs": "^17.5.1"
|
81
78
|
}
|
82
79
|
}
|
@@ -1,47 +0,0 @@
|
|
1
|
-
const fs = require('fs');
|
2
|
-
const path = require('path');
|
3
|
-
const mkdirp = require('mkdirp');
|
4
|
-
|
5
|
-
const proccessCSS = css => {
|
6
|
-
css = css.replace(/\.sapThemeMeta[\s\S]*?:root/, ":root");
|
7
|
-
css = css.replace(/\.background-image.*{.*}/, "");
|
8
|
-
css = css.replace(/\.sapContrast[ ]*:root[\s\S]*?}/, "");
|
9
|
-
css = css.replace(/--sapFontUrl.*\);?/, "");
|
10
|
-
return css;
|
11
|
-
}
|
12
|
-
|
13
|
-
module.exports = function (opts) {
|
14
|
-
opts = opts || {};
|
15
|
-
|
16
|
-
return {
|
17
|
-
postcssPlugin: 'postcss-css-to-json',
|
18
|
-
Once (root) {
|
19
|
-
let css = root.toString();
|
20
|
-
css = proccessCSS(css);
|
21
|
-
|
22
|
-
const targetFile = root.source.input.from.replace(`/${opts.toReplace}/`, "/dist/generated/assets/").replace(`\\${opts.toReplace}\\`, "\\dist\\generated\\assets\\");
|
23
|
-
mkdirp.sync(path.dirname(targetFile));
|
24
|
-
|
25
|
-
const filePath = `${targetFile}.json`;
|
26
|
-
const data = {
|
27
|
-
packageName: opts.packageName,
|
28
|
-
fileName: targetFile.substr(targetFile.lastIndexOf("themes")),
|
29
|
-
content: css
|
30
|
-
};
|
31
|
-
// it seems slower to read the old content, but writing the same content with no real changes
|
32
|
-
// (as in initial build and then watch mode) will cause an unnecessary dev server refresh
|
33
|
-
let oldContent = "";
|
34
|
-
try {
|
35
|
-
oldContent = fs.readFileSync(filePath).toString();
|
36
|
-
} catch (e) {
|
37
|
-
// file not found
|
38
|
-
}
|
39
|
-
const content = JSON.stringify({_: data});
|
40
|
-
if (content !== oldContent) {
|
41
|
-
fs.writeFileSync(filePath, content);
|
42
|
-
}
|
43
|
-
}
|
44
|
-
};
|
45
|
-
};
|
46
|
-
|
47
|
-
module.exports.postcss = true;
|
@@ -1,36 +0,0 @@
|
|
1
|
-
const chokidar = require("chokidar");
|
2
|
-
const commandLineArgs = require("command-line-args");
|
3
|
-
const { exec } = require("child_process");
|
4
|
-
|
5
|
-
const options = commandLineArgs([
|
6
|
-
{ name: "srcFiles", type: String },
|
7
|
-
]);
|
8
|
-
|
9
|
-
const runPostcss = path => {
|
10
|
-
let command = `postcss ${path} --config config/postcss.components --base src --dir dist/css/`;
|
11
|
-
console.log(`Executing: ${command}`);
|
12
|
-
exec(command, (err, stdout, stderr) => {
|
13
|
-
if (err) {
|
14
|
-
console.log(`Could not run postcss for ${path}. Error: ${err}`);
|
15
|
-
}
|
16
|
-
});
|
17
|
-
|
18
|
-
command = `${command} -w`;
|
19
|
-
console.log(`Executing: ${command}`);
|
20
|
-
exec(command, (err, stdout, stderr) => {
|
21
|
-
if (err) {
|
22
|
-
console.log(`Could not run postcss in watch mode for ${path}. Error: ${err}`);
|
23
|
-
}
|
24
|
-
});
|
25
|
-
};
|
26
|
-
|
27
|
-
let ready = false; // Do nothing until the ready event has been fired (we don't want to recompile all files initially)
|
28
|
-
const watcher = chokidar.watch(options.srcFiles);
|
29
|
-
watcher.on("ready", () => {
|
30
|
-
ready = true; // Initial scan is over -> waiting for new files
|
31
|
-
});
|
32
|
-
watcher.on("add", path => {
|
33
|
-
if (ready) {
|
34
|
-
runPostcss(path);
|
35
|
-
}
|
36
|
-
});
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import 'zx/globals';
|
2
|
-
|
3
|
-
// don't print executed commands and their output
|
4
|
-
$.verbose = false;
|
5
|
-
|
6
|
-
const inputFiles = await globby("src/**/parameters-bundle.css");
|
7
|
-
|
8
|
-
const restArgs = process.argv.slice(2);
|
9
|
-
|
10
|
-
// run all postcss processes in parallel as passing the glob directly to postcss makes them processed sequentially.
|
11
|
-
// and the amount of imports give a big speed up when run in parallel
|
12
|
-
await Promise.all(inputFiles.map(file => {
|
13
|
-
return $`postcss ${file} --config config/postcss.themes --base src --dir dist/css/ ${restArgs}`;
|
14
|
-
}));
|