Skip to content

Commit ba991a8

Browse files
committed
Update frontend files and add script
1 parent 0a4464f commit ba991a8

File tree

3 files changed

+1767
-851
lines changed

3 files changed

+1767
-851
lines changed

remove_js_comments.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Check if a filename is provided
4+
if [ -z "$1" ]; then
5+
echo "Usage: $0 <filename>"
6+
exit 1
7+
fi
8+
9+
# Check if the file exists
10+
if [ ! -f "$1" ]; then
11+
echo "Error: File '$1' not found."
12+
exit 1
13+
fi
14+
15+
# Use awk to remove lines starting with optional whitespace then //
16+
# This does NOT remove comments appearing after code on the same line.
17+
# Note: This creates a temporary file for safety.
18+
awk '!/^[[:space:]]*\/\// {print}' "$1" > "$1.tmp" && mv "$1.tmp" "$1"
19+
20+
echo "Removed full-line comments (potentially indented) from '$1'."

0 commit comments

Comments
 (0)