24 lines
681 B
JavaScript
24 lines
681 B
JavaScript
// generateHtaccess.js
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import { baseUrl } from '../vite.config.js';
|
|
|
|
// Obsah .htaccess súboru
|
|
const htaccessContent = `
|
|
<IfModule mod_rewrite.c>
|
|
RewriteEngine On
|
|
RewriteBase ${baseUrl}
|
|
RewriteRule ^index\\.html$ - [L]
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteRule . ${baseUrl}index.html [L]
|
|
</IfModule>
|
|
`;
|
|
|
|
// Určte cestu pre vygenerovanie .htaccess do dist/
|
|
const distPath = path.join(process.cwd(), 'dist', '.htaccess');
|
|
|
|
// Zapíšte obsah do súboru .htaccess
|
|
fs.writeFileSync(distPath, htaccessContent, 'utf8');
|
|
console.log('.htaccess bol úspešne vygenerovaný do dist/');
|