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/add-css.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 Recipes/add-css.sh (limited to 'Recipes/add-css.sh') diff --git a/Recipes/add-css.sh b/Recipes/add-css.sh new file mode 100755 index 0000000..bb77bd6 --- /dev/null +++ b/Recipes/add-css.sh @@ -0,0 +1,27 @@ +#!/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 + +# CSS link tag to add +css_link=' ' + +# Use sed to add the CSS link after the line +sed '//a\ +'"$css_link" "$file" >temp_file + +# Replace the original file with the modified content +mv temp_file "$file" +echo "Added CSS link to $file" -- cgit v1.2.3