From ef3f8f8e0c03e7f2095ca64e70c1f664c9f2fcf7 Mon Sep 17 00:00:00 2001 From: Szymon Szukalski Date: Mon, 25 Nov 2024 15:07:49 +1100 Subject: Externalise css --- Recipes/remove-styles.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 Recipes/remove-styles.sh (limited to 'Recipes/remove-styles.sh') 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 " + 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 , inclusive +sed ':a; /]*>/,/<\/style>/ { /<\/style>/! { N; ba; }; d; }' "$file" >temp_file + +# Replace the original file with the modified content +mv temp_file "$file" +echo "Removed