@openedx/paragon 23.8.0 → 23.9.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/bin/paragon-scripts.js +5 -0
- package/lib/__tests__/build-scss.test.js +14 -0
- package/lib/build-scss.js +10 -6
- package/package.json +1 -1
package/bin/paragon-scripts.js
CHANGED
|
@@ -147,6 +147,11 @@ const COMMANDS = {
|
|
|
147
147
|
description: 'Path to the theme\'s core SCSS file, defaults to Paragon\'s core.scss.',
|
|
148
148
|
defaultValue: 'styles/scss/core/core.scss',
|
|
149
149
|
},
|
|
150
|
+
{
|
|
151
|
+
name: '--excludeCore',
|
|
152
|
+
description: 'Exclude core from the SCSS build.',
|
|
153
|
+
defaultValue: false,
|
|
154
|
+
},
|
|
150
155
|
{
|
|
151
156
|
name: '--themesPath',
|
|
152
157
|
description: `Path to the directory that contains themes' files. Expects directory to have following structure:
|
|
@@ -143,4 +143,18 @@ describe('buildScssCommand', () => {
|
|
|
143
143
|
expect.any(Object),
|
|
144
144
|
);
|
|
145
145
|
});
|
|
146
|
+
|
|
147
|
+
it('should exclude core properly', () => {
|
|
148
|
+
buildScssCommand(['--excludeCore']);
|
|
149
|
+
|
|
150
|
+
expect(sass.compile).not.toHaveBeenCalledWith(
|
|
151
|
+
expect.stringContaining('core.scss'),
|
|
152
|
+
expect.any(Object),
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
expect(fs.readdirSync).toHaveBeenCalledWith(
|
|
156
|
+
expect.stringContaining('themes'),
|
|
157
|
+
expect.objectContaining({ withFileTypes: true }),
|
|
158
|
+
);
|
|
159
|
+
});
|
|
146
160
|
});
|
package/lib/build-scss.js
CHANGED
|
@@ -154,6 +154,7 @@ const compileAndWriteStyleSheets = ({
|
|
|
154
154
|
function buildScssCommand(commandArgs) {
|
|
155
155
|
const defaultArgs = {
|
|
156
156
|
corePath: path.resolve(process.cwd(), 'styles/scss/core/core.scss'),
|
|
157
|
+
excludeCore: false,
|
|
157
158
|
themesPath: path.resolve(process.cwd(), 'styles/css/themes'),
|
|
158
159
|
outDir: './dist',
|
|
159
160
|
defaultThemeVariants: 'light',
|
|
@@ -161,17 +162,20 @@ function buildScssCommand(commandArgs) {
|
|
|
161
162
|
|
|
162
163
|
const {
|
|
163
164
|
corePath,
|
|
165
|
+
excludeCore,
|
|
164
166
|
themesPath,
|
|
165
167
|
outDir,
|
|
166
168
|
defaultThemeVariants,
|
|
167
|
-
} = minimist(commandArgs, { default: defaultArgs });
|
|
169
|
+
} = minimist(commandArgs, { default: defaultArgs, boolean: ['excludeCore'] });
|
|
168
170
|
|
|
169
171
|
// Core CSS
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
if (!excludeCore) {
|
|
173
|
+
compileAndWriteStyleSheets({
|
|
174
|
+
name: 'core',
|
|
175
|
+
stylesPath: corePath,
|
|
176
|
+
outDir,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
175
179
|
|
|
176
180
|
// Theme Variants CSS
|
|
177
181
|
fs.readdirSync(themesPath, { withFileTypes: true })
|