Explorar el Código

build-docs: Clean up stale .html files before generating new ones.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mr.doob hace 2 semanas
padre
commit
ed98cc4aa1
Se han modificado 1 ficheros con 15 adiciones y 0 borrados
  1. 15 0
      utils/docs/template/publish.js

+ 15 - 0
utils/docs/template/publish.js

@@ -725,6 +725,21 @@ exports.publish = ( taffyData, opts, tutorials ) => {
 
 	fs.mkPath( outdir );
 
+	// Remove stale .html files from previous builds
+	const pagesDir = path.join( outdir, 'pages' );
+
+	if ( fs.existsSync( pagesDir ) ) {
+
+		const existingHtmlFiles = fs.readdirSync( pagesDir ).filter( f => f.endsWith( '.html' ) );
+
+		for ( const file of existingHtmlFiles ) {
+
+			fs.unlinkSync( path.join( pagesDir, file ) );
+
+		}
+
+	}
+
 	// copy the template's static files to outdir
 	const fromDir = path.join( templatePath, 'static' );
 	const staticFiles = fs.ls( fromDir, 3 );

粤ICP备19079148号