Skip to content

Commit

Permalink
Fixed support for .gitignore Monaco virtual-files
Browse files Browse the repository at this point in the history
Completed .gitignore Monaco virtual-file
  • Loading branch information
hopperelec committed Jun 15, 2024
1 parent 2759733 commit f9b0df1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/lib/media/monaco-viewer/virtual-files/.gitignore

This file was deleted.

1 change: 1 addition & 0 deletions src/lib/media/monaco-viewer/virtual-files/_._gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# I use Git for all my projects and have grown a great understanding of VCS
6 changes: 3 additions & 3 deletions src/routes/Projects.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
let activeFile: MonacoFile;
const PATH_REGEX = RegExp(/\/virtual-files\/(.*?)([^\/]+?(\.([^\/.]+))?)$/);
const PATH_REGEX = RegExp(/\/virtual-files\/(.*?)([^\/]+?(\._?([^\/.]+))?)$/);
const files: MonacoFile[] = Object.entries(
import.meta.glob("$lib/media/monaco-viewer/virtual-files/**/*", {
query: "?raw",
Expand All @@ -17,8 +17,8 @@ const files: MonacoFile[] = Object.entries(
).map(([originalPathFilename, contentsPromise]) => {
let [trimmedPathFilename, virtualPath, filename, _, extension] =
PATH_REGEX.exec(originalPathFilename) as RegExpExecArray;
// SvelteKit prevents importing files ending with "server.ts", so I add an underscore to the filenames
filename = filename.replace(/_server\.ts$/, "server.ts"); // Remove that underscore, if it exists
// SvelteKit prevents importing some files, so I add an underscore next to the dot in the filenames
filename = filename.replace(/_?\._?/, "."); // Remove that underscore, if it exists
const file: MonacoFile = {
name: filename,
path: virtualPath,
Expand Down

0 comments on commit f9b0df1

Please sign in to comment.