mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	feat(docs-edit): minify meta JSON (429 KB gain)
This commit is contained in:
		| @@ -152,10 +152,11 @@ async function exportData(noteId: string, format: "html" | "markdown", outputPat | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     await cleanUpMeta(outputPath); |     const minifyMeta = (format === "html"); | ||||||
|  |     await cleanUpMeta(outputPath, minifyMeta); | ||||||
| } | } | ||||||
|  |  | ||||||
| async function cleanUpMeta(outputPath: string) { | async function cleanUpMeta(outputPath: string, minify: boolean) { | ||||||
|     const metaPath = path.join(outputPath, "!!!meta.json"); |     const metaPath = path.join(outputPath, "!!!meta.json"); | ||||||
|     const meta = JSON.parse(await fs.readFile(metaPath, "utf-8")) as NoteMetaFile; |     const meta = JSON.parse(await fs.readFile(metaPath, "utf-8")) as NoteMetaFile; | ||||||
|     for (const file of meta.files) { |     for (const file of meta.files) { | ||||||
| @@ -171,7 +172,8 @@ async function cleanUpMeta(outputPath: string) { | |||||||
|         el.isExpanded = false; |         el.isExpanded = false; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     await fs.writeFile(metaPath, JSON.stringify(meta, null, 4)); |     const json = minify ? JSON.stringify(meta) : JSON.stringify(meta, null, 4); | ||||||
|  |     await fs.writeFile(metaPath, json); | ||||||
| } | } | ||||||
|  |  | ||||||
| async function registerHandlers() { | async function registerHandlers() { | ||||||
|   | |||||||
							
								
								
									
										11140
									
								
								src/public/app/doc_notes/en/User Guide/!!!meta.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										11140
									
								
								src/public/app/doc_notes/en/User Guide/!!!meta.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user