Skip to content

Commit

Permalink
Remove fonts from repo
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Oct 20, 2023
1 parent 62dbb83 commit c6a22f6
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 10 deletions.
6 changes: 5 additions & 1 deletion scraper/get_js_deps.sh → scraper/get_web_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ fi
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
ASSETS_PATH="${SCRIPT_PATH}/src/kolibri2zim/templates/assets"

echo "About to download JS assets to ${ASSETS_PATH}"
echo "About to download web assets to ${ASSETS_PATH}"

echo "getting lato font"
curl -L -o $ASSETS_PATH/lato-v24-latin-regular.ttf https://dev.kiwix.org/fonts/lato/lato-v24-latin-regular.ttf
curl -L -o $ASSETS_PATH/lato-v24-latin-regular.woff2 https://dev.kiwix.org/fonts/lato/lato-v24-latin-regular.woff2

echo "getting pdf.js"
curl -L -O https://github.com/mozilla/pdf.js/releases/download/v2.6.347/pdfjs-2.6.347-es5-dist.zip
Expand Down
8 changes: 5 additions & 3 deletions scraper/hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
logger = logging.getLogger(__name__)

# update list in constants.py as well
JS_DEPS = [
WEB_DEPS = [
"pdfjs",
"videojs",
"ogvjs",
Expand All @@ -19,6 +19,8 @@
"jszip.min.js",
"jquery.min.js",
"videojs-ogvjs.js",
"lato-v24-latin-regular.woff2",
"lato-v24-latin-regular.ttf",
]


Expand All @@ -29,13 +31,13 @@ def initialize(self, version, build_data):
return
Path(self.root).joinpath("src/kolibri2zim/templates/assets")
subprocess.run(
str(Path(self.root).joinpath("get_js_deps.sh")),
str(Path(self.root).joinpath("get_web_deps.sh")),
check=True,
)
return super().initialize(version, build_data)

def deps_already_installed(self) -> bool:
for dep in JS_DEPS:
for dep in WEB_DEPS:
if (
not Path(self.root)
.joinpath("src/kolibri2zim/templates/assets")
Expand Down
4 changes: 3 additions & 1 deletion scraper/src/kolibri2zim/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
STUDIO_URL = os.getenv("STUDIO_URL", STUDIO_DEFAULT_BASE_URL)

# when modifiying this list, update list in hatch_build.py as well
JS_DEPS: list[str] = [
WEB_DEPS: list[str] = [
"pdfjs",
"videojs",
"ogvjs",
Expand All @@ -32,6 +32,8 @@
"jszip.min.js",
"jquery.min.js",
"videojs-ogvjs.js",
"lato-v24-latin-regular.woff2",
"lato-v24-latin-regular.ttf",
]


Expand Down
6 changes: 3 additions & 3 deletions scraper/src/kolibri2zim/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from zimscraperlib.zim.creator import Creator
from zimscraperlib.zim.items import StaticItem

from kolibri2zim.constants import JS_DEPS, ROOT_DIR, STUDIO_URL, Global, get_logger
from kolibri2zim.constants import ROOT_DIR, STUDIO_URL, WEB_DEPS, Global, get_logger
from kolibri2zim.database import KolibriDB
from kolibri2zim.debug import (
ON_DISK_THRESHOLD,
Expand Down Expand Up @@ -1186,9 +1186,9 @@ def add_custom_about_and_css(self):
logger.debug("Added about page and custom CSS")

def ensure_js_deps_are_present(self):
for dep in JS_DEPS:
for dep in WEB_DEPS:
if not self.templates_dir.joinpath(f"assets/{dep}").exists():
raise ValueError(
"It looks like JS deps have not been installed,"
"It looks like web deps have not been installed,"
f" {dep} is missing"
)
1 change: 1 addition & 0 deletions scraper/src/kolibri2zim/templates/assets/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ epub.min.js
bootstrap-icons/
jszip.min.js
perseus/
lato*
6 changes: 4 additions & 2 deletions zimui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ div {
font-weight: 400;
font-style: normal;
font-display: swap;
src: url('./fonts/lato-v24-latin-regular.woff2') format('woff2'),
src:
/* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
url('./fonts/lato-v24-latin-regular.ttf') format('truetype'); /* Chrome 4+, Firefox 3.5+, IE 9+, Safari 3.1+, iOS 4.2+, Android Browser 2.2+ */
url('./assets/lato-v24-latin-regular.woff2') format('woff2'),
/* Chrome 4+, Firefox 3.5+, IE 9+, Safari 3.1+, iOS 4.2+, Android Browser 2.2+ */
url('./assets/lato-v24-latin-regular.ttf') format('truetype');
}
</style>
Binary file removed zimui/src/fonts/lato-v24-latin-regular.ttf
Binary file not shown.
Binary file removed zimui/src/fonts/lato-v24-latin-regular.woff2
Binary file not shown.

0 comments on commit c6a22f6

Please sign in to comment.