File tree Expand file tree Collapse file tree 3 files changed +29
-6
lines changed Expand file tree Collapse file tree 3 files changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -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:
Original file line number Diff line number Diff line change @@ -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
} ) ;
Original file line number Diff line number Diff line change @@ -154,24 +154,28 @@ 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' ,
160
161
} ;
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
- compileAndWriteStyleSheets ( {
171
- name : 'core' ,
172
- stylesPath : corePath ,
173
- outDir,
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 } )
You can’t perform that action at this time.
0 commit comments