File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import { dartCompile } from "./dart-sass.ts";
1717import * as ld from "./lodash.ts" ;
1818import { lines } from "./text.ts" ;
1919import { md5Hash } from "./hash.ts" ;
20+ import { debug } from "../vendor/deno.land/[email protected] /log/mod.ts" ; 2021
2122export interface SassVariable {
2223 name : string ;
@@ -314,9 +315,13 @@ export async function compileWithCache(
314315 let cacheIndex : { [ key : string ] : { key : string ; hash : string } } = { } ;
315316 let writeCache = true ;
316317 if ( existsSync ( outputFilePath ) ) {
317- cacheIndex = JSON . parse ( Deno . readTextFileSync ( cacheIdxPath ) ) ;
318- const existingEntry = cacheIndex [ identifierHash ] ;
319- writeCache = ! existingEntry || ( existingEntry . hash !== inputHash ) ;
318+ try {
319+ cacheIndex = JSON . parse ( Deno . readTextFileSync ( cacheIdxPath ) ) ;
320+ const existingEntry = cacheIndex [ identifierHash ] ;
321+ writeCache = ! existingEntry || ( existingEntry . hash !== inputHash ) ;
322+ } catch {
323+ debug ( `The scss cache index file ${ cacheIdxPath } can't be read.` ) ;
324+ }
320325 }
321326
322327 // We need to refresh the cache
You can’t perform that action at this time.
0 commit comments