-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #169 from fuggla/bootstrap-fonts
Download bootstrap-icons fonts in local_mode
- Loading branch information
Showing
1 changed file
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from collections import namedtuple | ||
from os import path | ||
from os import path, makedirs | ||
|
||
import requests | ||
|
||
|
@@ -25,6 +25,14 @@ | |
local="/static/css/bootstrap-icons.css", | ||
external="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" | ||
), | ||
"bootstrap-icons.woff": WebDependency( | ||
local="/static/css/fonts/bootstrap-icons.woff", | ||
external="https://cdn.jsdelivr.net/npm/[email protected]/font/fonts/bootstrap-icons.woff" | ||
), | ||
"bootstrap-icons.woff2": WebDependency( | ||
local="/static/css/fonts/bootstrap-icons.woff2", | ||
external="https://cdn.jsdelivr.net/npm/[email protected]/font/fonts/bootstrap-icons.woff2" | ||
), | ||
"jquery.slim.min.js": WebDependency( | ||
local="/static/js/jquery.slim.min.js", | ||
external="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js" | ||
|
@@ -116,6 +124,12 @@ def download_web_deps(logger): | |
for dep_name in WEB_DEPENDENCIES: | ||
dep = WEB_DEPENDENCIES[dep_name] | ||
dep_file_path = path.join(path.dirname(__file__), dep.local[1:]) # Drop the first '/' so join works | ||
dep_folder_path = path.dirname(dep_file_path) | ||
|
||
# Dependency parent folder is not present and has to be created | ||
if not path.exists(dep_folder_path): | ||
logger.info(f"Creating dependency folder {dep_folder_path}") | ||
makedirs(dep_folder_path) | ||
|
||
# File is not present and has to be downloaded | ||
if not path.exists(dep_file_path): | ||
|