A beautiful, responsive web-based code viewer built with React that mimics VS Code's interface. Perfect for sharing and viewing code snippets, files, or entire projects on the web.
- π¨ VS Code-like interface with syntax highlighting
- π Light/Dark/Dracula theme support
- π File explorer with directory structure
- β‘ Fast and responsive
- π± Mobile-friendly
- π Large file handling with loading states
- π Copy code functionality
- π Beautiful animations
# Clone this repository
git clone https://github.com/1sisodiyaji/vs-code-web.git
# Go to the project directory
cd vs-code-web
# Install dependencies
npm install
# Copy your project files into a directory (e.g., 'my-code')
cp -r /path/to/your/code my-code/
# Update the file structure
npm run update-files -- my-code
# Start the server
npm run devNow you can view and share your code through a beautiful VS Code-like interface!
- Fork this repository
- Enable GitHub Pages in your fork's settings
- Update the file structure with your code:
npm run update-files -- your-code-directory
- Push to GitHub
- Share the GitHub Pages URL with others
<!-- Add this iframe to your website -->
<iframe
src="https://your-username.github.io/vs-code-web"
width="100%"
height="600px"
frameborder="0">
</iframe>-
Clone the repository
-
Copy the required components:
src/components/Editor.jsxsrc/components/FileExplorer.jsxsrc/context/ThemeContext.jsx
-
Install dependencies:
npm install prismjs framer-motion lucide-react @mdi/react @mdi/js- Import and use in your React app:
import Editor from './components/Editor';
import FileExplorer from './components/FileExplorer';
import { ThemeProvider } from './context/ThemeContext';
function App() {
return (
<ThemeProvider>
<div className="flex">
<FileExplorer data={yourFileStructure} />
<Editor file={selectedFile} />
</div>
</ThemeProvider>
);
}Use it to display your project's documentation with syntax highlighting:
npm run update-files -- ./docsShowcase your code projects:
# Create a projects directory
mkdir projects
# Add your project files
cp -r project1 project2 project3 ./projects
# Update file structure
npm run update-files -- ./projectsCreate interactive coding tutorials:
# Structure your tutorials
tutorials/
βββ lesson1/
β βββ start.js
β βββ final.js
βββ lesson2/
β βββ start.js
β βββ final.jsEdit src/context/ThemeContext.jsx:
const themes = {
light: {
bg: '#ffffff',
text: '#000000',
// Add your colors
}
};In src/components/Editor.jsx, import additional Prism languages:
import 'prismjs/components/prism-python';
import 'prismjs/components/prism-java';
// Add more languagesModify src/components/FileExplorer.jsx to:
- Change icons
- Add file filters
- Customize sorting
Adjust file size limits in scripts/updateFileStructure.js:
const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MBCurrently supports:
- JavaScript/JSX
- JSON
- CSS
- HTML
- And more...
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with React
- Syntax highlighting by Prism.js
- Icons from Lucide
- Animations powered by Framer Motion
