@@ -23,6 +23,7 @@ export class Article {
23
23
this . _codeBlockData = null ;
24
24
this . _referencedAssetsPaths = null ;
25
25
this . _emphasizedTextData = null ;
26
+ this . _assetFolder = null ;
26
27
}
27
28
28
29
/**
@@ -259,28 +260,20 @@ export class Article {
259
260
*/
260
261
get assetsFolder ( ) {
261
262
if ( this . _assetFolder ) return this . _assetFolder ;
262
- const validDirectories = [ "assets" , "images" ] ;
263
263
264
- if ( existsSync ( `${ this . path } /${ validDirectories [ 0 ] } /` ) ) {
265
- this . _assetFolder = validDirectories [ 0 ] ;
266
- return this . _assetFolder ;
267
- }
268
- if ( existsSync ( `${ this . path } /${ validDirectories [ 1 ] } /` ) ) {
269
- console . log ( "😬 WARNING: Using deprecated 'images' directory to store assets. Location:" , this . path ) ;
270
- this . _assetFolder = validDirectories [ 1 ] ;
271
- return this . _assetFolder ;
272
- }
273
-
274
- // Try to figure out assets path from the referenced images
264
+ // Figure out assets path(s) from the referenced images
275
265
const usedAssetPaths = this . referencedImages . map ( ( assetPath ) => {
276
266
const directory = path . dirname ( assetPath )
277
267
if ( ! directory ) return null ;
278
268
return directory . split ( "/" ) [ 0 ] ;
279
- } )
269
+ } ) ;
280
270
281
271
const uniqueAssetPaths = usedAssetPaths . filter ( ( element , index ) => { return usedAssetPaths . indexOf ( element ) == index ; } ) ;
282
- if ( uniqueAssetPaths . length == 1 ) return uniqueAssetPaths [ 0 ] ;
283
- return null ;
272
+ if ( uniqueAssetPaths . length == 1 ) {
273
+ this . _assetFolder = uniqueAssetPaths [ 0 ] ;
274
+ }
275
+
276
+ return this . _assetFolder ;
284
277
}
285
278
286
279
/**
0 commit comments