File tree Expand file tree Collapse file tree 2 files changed +26
-12
lines changed Expand file tree Collapse file tree 2 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -25,12 +25,19 @@ async function compileStyles () {
2525
2626 let srcContent = await readFile ( cfg . entry , 'utf-8' ) ;
2727
28- let output = await LESS . render ( srcContent , {
29- paths : CONFIG . less . paths . map ( ( filepath ) => {
30- return path . join ( CONFIG . root , filepath ) ;
31- } ) ,
32- filename : path . basename ( cfg . entry )
33- } ) ;
28+ let output = '' ;
29+ try {
30+ output = await LESS . render ( srcContent , {
31+ paths : CONFIG . less . paths . map ( ( filepath ) => {
32+ return path . join ( CONFIG . root , filepath ) ;
33+ } ) ,
34+ filename : path . basename ( cfg . entry )
35+ } ) ;
36+ } catch ( err ) {
37+ console . log ( `[COMPILE:Styles] Error: ${ err . message } ` ) ;
38+ console . log ( '[COMPILE:Styles] skipping CSS compilation' )
39+ return ;
40+ }
3441
3542 let minified = new CleanCSS ( {
3643 advanced : true ,
Original file line number Diff line number Diff line change @@ -21,12 +21,19 @@ async function generateStyles () {
2121
2222 let srcContent = await readFile ( `${ CONFIG . docsDir } /docs.less` , 'utf-8' ) ;
2323
24- let output = await LESS . render ( srcContent , {
25- paths : CONFIG . less . paths . map ( ( filepath ) => {
26- return path . join ( CONFIG . root , filepath ) ;
27- } ) ,
28- filename : 'docs.less' ,
29- } ) ;
24+ let output = '' ;
25+ try {
26+ output = await LESS . render ( srcContent , {
27+ paths : CONFIG . less . paths . map ( ( filepath ) => {
28+ return path . join ( CONFIG . root , filepath ) ;
29+ } ) ,
30+ filename : 'docs.less' ,
31+ } ) ;
32+ } catch ( err ) {
33+ console . log ( `[GENERATE:Styles] Error: ${ err . message } ` ) ;
34+ console . log ( '[GENERATE:Styles] skipping CSS compilation' )
35+ return ;
36+ }
3037
3138 await ensureDir ( CONFIG . publicDir ) ;
3239 await writeFile ( `${ CONFIG . publicDir } /docs.css` , output . css ) ;
You can’t perform that action at this time.
0 commit comments