sdc-build-wp 3.2.0 → 3.2.2
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/.nvmrc +1 -0
- package/lib/style.js +9 -7
- package/package.json +1 -1
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
20
|
package/lib/style.js
CHANGED
|
@@ -14,7 +14,7 @@ function camelToDash(camel) {
|
|
|
14
14
|
return camel.replace(/[A-Z]/g, m => '-' + m.toLowerCase());
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const buildSassTheme = async () => {
|
|
17
|
+
export const buildSassTheme = async () => {
|
|
18
18
|
try {
|
|
19
19
|
let theme = JSON.parse(await promises.readFile(project.path + '/theme.json'));
|
|
20
20
|
let themeFileData = `// This file is automatically generated from theme.json. Do not edit.\n`;
|
|
@@ -36,11 +36,15 @@ const buildSassTheme = async () => {
|
|
|
36
36
|
themeFileData += `$font-size-base: ${theme.styles.typography.fontSize}; // --wp--preset--font-size\n`;
|
|
37
37
|
if (theme.settings.custom && theme.settings.custom['breakpoints-rem']) {
|
|
38
38
|
for (var breakpoint in theme.settings.custom['breakpoints-rem']) {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
if (theme.settings.custom['breakpoints-rem'][breakpoint].toString().includes('rem')) {
|
|
40
|
+
themeFileData += `$screen-${breakpoint}: ${theme.settings.custom['breakpoints-rem'][breakpoint]}; // --wp--custom--breakpoints-rem--${breakpoint}\n`;
|
|
41
|
+
} else {
|
|
42
|
+
themeFileData += `$screen-${breakpoint}: ${theme.settings.custom['breakpoints-rem'][breakpoint]}rem; // --wp--custom--breakpoints-rem--${breakpoint} (without 'rem')\n`;
|
|
43
|
+
}
|
|
44
|
+
themeFileData += `$screen-${breakpoint}-px: ${theme.settings.custom['breakpoints-rem'][breakpoint].toString().replace('rem', '') * fontSizeBase.replace('px', '')}px;\n`;
|
|
41
45
|
}
|
|
42
46
|
if (theme.settings.custom['breakpoint-mobile']) {
|
|
43
|
-
themeFileData += `$mobile-breakpoint: $screen-${theme.settings.custom['breakpoint-mobile']}
|
|
47
|
+
themeFileData += `$mobile-breakpoint: $screen-${theme.settings.custom['breakpoint-mobile']}; // --wp--custom--breakpoint-mobile \n`;
|
|
44
48
|
themeFileData += `$mobile-breakpoint-px: $screen-${theme.settings.custom['breakpoint-mobile']}-px;\n`;
|
|
45
49
|
}
|
|
46
50
|
}
|
|
@@ -73,7 +77,7 @@ const buildSassTheme = async () => {
|
|
|
73
77
|
}
|
|
74
78
|
};
|
|
75
79
|
|
|
76
|
-
const buildSass = async (entry, name, entriesToLint) => {
|
|
80
|
+
export const buildSass = async (entry, name, entriesToLint) => {
|
|
77
81
|
let timerStart = Date.now();
|
|
78
82
|
let outFile = project.path + '/dist/' + name + '.min.css';
|
|
79
83
|
if (name.startsWith('blocks/')) {
|
|
@@ -131,5 +135,3 @@ const buildSass = async (entry, name, entriesToLint) => {
|
|
|
131
135
|
}
|
|
132
136
|
});
|
|
133
137
|
};
|
|
134
|
-
|
|
135
|
-
export { buildSass, buildSassTheme };
|