Skip to content

Commit b002135

Browse files
author
Parsa Azari
committed
Setup GitHub Pages deployment
1 parent 7366712 commit b002135

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Update shader loading paths
2+
const loadShader = async (shaderPath) => {
3+
try {
4+
// Use absolute path for GitHub Pages
5+
const response = await fetch(`${import.meta.env.BASE_URL}${shaderPath}`);
6+
if (!response.ok) throw new Error(`Shader load failed: ${response.status}`);
7+
return await response.text();
8+
} catch (error) {
9+
console.error(`Error loading shader: ${shaderPath}`, error);
10+
throw error;
11+
}
12+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const wallVertexShader = () => `${import.meta.env.BASE_URL}src/shaders/wall.vert.glsl`;
2+
const wallFragmentShader = () => `${import.meta.env.BASE_URL}src/shaders/wall.frag.glsl`;

3D-Portfolio/vite.config.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1+
import { defineConfig } from 'vite';
2+
import react from '@vitejs/plugin-react';
3+
import path from 'path';
4+
15
export default defineConfig({
26
base: '/3D-Portfolio/',
37
plugins: [react()],
4-
})
8+
build: {
9+
assetsInclude: ['**/*.glsl'],
10+
rollupOptions: {
11+
input: {
12+
main: path.resolve(__dirname, 'index.html'),
13+
},
14+
output: {
15+
assetFileNames: 'assets/[name][extname]',
16+
entryFileNames: 'js/[name].js',
17+
}
18+
}
19+
},
20+
server: {
21+
fs: {
22+
strict: false,
23+
}
24+
}
25+
});

0 commit comments

Comments
 (0)