mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-11-03 09:22:01 +00:00 
			
		
		
		
	* hide buttons in dropdown menu * use npm as deps manager and vite as bundler * fix build * fix build (2) * fix responsive on mobile * fix more problems on mobile * sync build * (test) add CI step for verifying build * fix ci * force rebuild .hpp files * cmake: clean up generated files pre build
		
			
				
	
	
		
			37 lines
		
	
	
		
			993 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			993 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
 | 
						|
import { viteSingleFile } from 'vite-plugin-singlefile';
 | 
						|
import path from 'path';
 | 
						|
import fs from 'fs';
 | 
						|
 | 
						|
const GUIDE_FOR_FRONTEND = `
 | 
						|
<!--
 | 
						|
  This is a single file build of the frontend.
 | 
						|
  It is automatically generated by the build process.
 | 
						|
  Do not edit this file directly.
 | 
						|
  To make changes, refer to the "Web UI" section in the README.
 | 
						|
-->
 | 
						|
`.trim();
 | 
						|
 | 
						|
export default {
 | 
						|
  plugins: [
 | 
						|
    viteSingleFile(),
 | 
						|
    (function llamaCppPlugin() {
 | 
						|
      let config;
 | 
						|
      return {
 | 
						|
        name: 'llamacpp:build',
 | 
						|
        apply: 'build',
 | 
						|
        async configResolved(_config) {
 | 
						|
          config = _config;
 | 
						|
        },
 | 
						|
        writeBundle() {
 | 
						|
          const outputIndexHtml = path.join(config.build.outDir, 'index.html');
 | 
						|
          const content = fs.readFileSync(outputIndexHtml, 'utf-8');
 | 
						|
 | 
						|
          const targetOutputFile = path.join(config.build.outDir, '../../public/index.html');
 | 
						|
          fs.writeFileSync(targetOutputFile, GUIDE_FOR_FRONTEND + '\n' + content);
 | 
						|
        }
 | 
						|
      }
 | 
						|
    })(),
 | 
						|
  ],
 | 
						|
};
 |