sdc-build-wp 2.0.3 → 2.1.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/index.js +1 -1
- package/lib/style.js +18 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -20,7 +20,7 @@ let chokidarOpts = {
|
|
|
20
20
|
let sassGlobPath = project.package?.sdc?.sassGlobPath || project.path + '/_src/style/**/*.scss';
|
|
21
21
|
let sassGlob = glob.sync(sassGlobPath, {
|
|
22
22
|
ignore: [
|
|
23
|
-
project.path + '/_src/style/partials/
|
|
23
|
+
project.path + '/_src/style/partials/_theme.scss'
|
|
24
24
|
]
|
|
25
25
|
});
|
|
26
26
|
|
package/lib/style.js
CHANGED
|
@@ -13,18 +13,27 @@ import { promises } from 'fs';
|
|
|
13
13
|
const buildColors = async () => {
|
|
14
14
|
try {
|
|
15
15
|
let theme = JSON.parse(await promises.readFile(project.path + '/theme.json'));
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
colorFileData += `$${color['slug']}: ${color['color']};\n`;
|
|
16
|
+
let themeFileData = `// This file is automatically generated. Do not edit.\n`;
|
|
17
|
+
if (theme.settings?.typography?.fontFamilies) {
|
|
18
|
+
for (var fontFamily of theme.settings.typography.fontFamilies) {
|
|
19
|
+
themeFileData += `$${fontFamily['slug']}: ${fontFamily['fontFamily']};\n`;
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
}
|
|
22
|
+
if (theme.settings?.color?.palette) {
|
|
23
|
+
for (var color of theme.settings.color.palette) {
|
|
24
|
+
themeFileData += `$${color['slug']}: ${color['color']};\n`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (theme.settings?.color?.gradients) {
|
|
28
|
+
for (var color of theme.settings.color.gradients) {
|
|
29
|
+
themeFileData += `$gradient-${color['slug']}: ${color['gradient']};\n`;
|
|
26
30
|
}
|
|
27
31
|
}
|
|
32
|
+
try {
|
|
33
|
+
await promises.writeFile(project.path + '/_src/style/partials/_theme.scss', themeFileData);
|
|
34
|
+
} catch {
|
|
35
|
+
log('error', `Failed to write auto-generated _theme.scss - See above error.`);
|
|
36
|
+
}
|
|
28
37
|
} catch {
|
|
29
38
|
log('error', `Failed to read theme.json - See above error.`);
|
|
30
39
|
}
|