summaryrefslogtreecommitdiff
path: root/Recipes/remove-styles.sh
diff options
context:
space:
mode:
authorSzymon Szukalski <szymon@skas.io>2024-11-25 15:07:49 +1100
committerSzymon Szukalski <szymon@skas.io>2024-11-25 15:07:49 +1100
commitef3f8f8e0c03e7f2095ca64e70c1f664c9f2fcf7 (patch)
tree14e8f75e0eca07675a93a7454af6fb99f0415084 /Recipes/remove-styles.sh
parent0fb3b92b04e48c8e7f9bb2c005541342a5d7ee0c (diff)
Externalise css
Diffstat (limited to 'Recipes/remove-styles.sh')
-rwxr-xr-xRecipes/remove-styles.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/Recipes/remove-styles.sh b/Recipes/remove-styles.sh
new file mode 100755
index 0000000..7618417
--- /dev/null
+++ b/Recipes/remove-styles.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Check if the user provided a file
+if [[ $# -ne 1 ]]; then
+ echo "Usage: $0 <filename>"
+ exit 1
+fi
+
+# File to process
+file="$1"
+
+# Check if the file exists
+if [[ ! -f "$file" ]]; then
+ echo "Error: File '$file' not found!"
+ exit 1
+fi
+
+# Use sed to delete everything between <style> and </style>, inclusive
+sed ':a; /<style[^>]*>/,/<\/style>/ { /<\/style>/! { N; ba; }; d; }' "$file" >temp_file
+
+# Replace the original file with the modified content
+mv temp_file "$file"
+echo "Removed <style> contents from $file"