Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in localinstall.sh leads to css files note found #86

Open
bjosel opened this issue Oct 17, 2024 · 4 comments
Open

bug in localinstall.sh leads to css files note found #86

bjosel opened this issue Oct 17, 2024 · 4 comments

Comments

@bjosel
Copy link

bjosel commented Oct 17, 2024

When I use the localinstall.sh script to full install the previewers locally on our servers the css files are located in the folder css but the path in the html files is set to lib (line 28). This leads to the css files not being found and some/most previewers not displaying the content correctly.

Possible fix is:

@@ -25,7 +25,7 @@
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 | sed -n 's/^(./)(.)/sed -i \x27s,\0,css/\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
@@ -67,4 +67,4 @@

@bjosel
Copy link
Author

bjosel commented Oct 17, 2024

Some previewers use fonts from bootstrap (glyphicons) which have to be installed locally, too.

qqmyers added a commit that referenced this issue Oct 25, 2024
@qqmyers
Copy link
Member

qqmyers commented Oct 25, 2024

Thanks for the fix. I've added it to the develop branch. If you'd like to propose changes/make a PR for the glyphicons, please do.

@bjosel
Copy link
Author

bjosel commented Nov 27, 2024

Hi Jim,
this would be a possible patch to add the icon fonts:

--- localinstall_fix.sh	2024-11-27 13:43:36.496655851 +0100
+++ localinstall_fonts.sh	2024-11-27 13:44:13.528100988 +0100
@@ -30,6 +30,14 @@
 source replace_css.sh
 cat urls_css.txt
 
+echo Downloading local copies of remote fonts:
+fonturl=`grep -m 1 https://stackpath.bootstrapcdn.com/ replace_css.sh | cut -d',' -f 2 | sed s,css/bootstrap.min.css,fonts,`
+echo $fonturl/glyphicons-halflings-regular.eot > urls_fonts.txt
+echo $fonturl/glyphicons-halflings-regular.svg >> urls_fonts.txt
+echo $fonturl/glyphicons-halflings-regular.ttf >> urls_fonts.txt
+echo $fonturl/glyphicons-halflings-regular.woff >> urls_fonts.txt
+echo $fonturl/glyphicons-halflings-regular.woff2 >> urls_fonts.txt
+
 if [ ! -d ./lib ]; then
   mkdir ./lib
 fi
@@ -48,6 +56,15 @@
     wget --quiet $url
 done < "../urls_css.txt"
 
+cd ".."
+if [ ! -d ./fonts ]; then
+  mkdir ./fonts
+fi
+cd ./fonts
+while read url; do
+    wget --quiet $url
+done < "../urls_fonts.txt"
+
 cd ..
 
 
@@ -63,6 +80,7 @@
 echo Cleaning Up...
 rm urls_js.txt
 rm urls_css.txt
+rm urls_fonts.txt
 rm replace_js.sh
 rm replace_css.sh

Although I am not sure if the licensing of glyphicons allows for a local download of the icons. This is maybe something that should be sorted before using the patch. If you confirm that there are no legal issues arising I can create a PR.
Regards
Björn

@qqmyers
Copy link
Member

qqmyers commented Nov 27, 2024

Thanks. While I'm not a lawyer, I think it's OK as we're using the subset that is part of bootstrap which is available for free - e.g. according to https://www.w3schools.com/bootstrap/bootstrap_ref_comp_glyphs.asp .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants