Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed May 22, 2024
1 parent 7e32887 commit 5a8ecea
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions localinstall.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
#!/bin/bash

dirLocal=$(pwd)


# go to the version folder
if [ -z "$1" ]; then
echo "The variable is empty."
echo "The variable is empty. Provide the relative path to the previewer version you wish to make an all-local instance of."
exit 1
fi
folder="$1"
cd "${folder}"


echo Downloading local copies of remote JavaScript libraries:
sed -n 's/.*src="\(http[^"]*\)".*/\1/p' *.html | sort -u | sed -n 's/^\(.*\/\)*\(.*\)/sed -i \x27s,\0\,lib\/\2,\x27 *.html/p' > replace_js.sh
sed -n 's/.*src="\(http[^"]*\)".*/\1/p' *.html | sort -u > urls_js.txt
source replace_js.sh
cat urls_js.txt

echo Downloading local copies of remote CSS files:
sed -n 's/.*<link.*href="\(http[^"]*\)".*/\1/p' *.html | sort -u | sed -n 's/^\(.*\/\)*\(.*\)/sed -i \x27s,\0\,lib\/\2,\x27 *.html/p' > replace_css.sh
sed -n 's/.*<link.*href="\(http[^"]*\)".*/\1/p' *.html | sort -u ?urls_css.txt
source replace_css.sh
cat urls_css.txt

if [ ! -d ./lib ]; then
mkdir ./lib
Expand All @@ -26,13 +30,22 @@ while read url; do
done < "../urls_js.txt"


cd ".."
cd "${folder}"
if [ ! -d ./css ]; then
mkdir ./css
fi
cd ./css
while read url; do
wget --quiet $url
done < "${dirLocal}/urls_css.txt"
done < "../urls_css.txt"

cd ..

echo Cleaning Up...
rm urls_js.txt
rm urls_css.txt
rm replace_js.sh
rm replace_css.sh

exit 0
echo Done
exit 0

0 comments on commit 5a8ecea

Please sign in to comment.