Skip to content

Commit ec828a2

Browse files
committed
feat: ensure generic is in correct folder
1 parent ea60311 commit ec828a2

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

generic/__init__.py

Whitespace-only changes.

generic/utils.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import json
2+
import os
3+
4+
def get_css_and_js_link_from_vite_assets(type):
5+
"""
6+
We read the vite diretory bath of the build from the manifest
7+
file and then use that to find our static assets to load the
8+
react application
9+
"""
10+
css_links = []
11+
js_links = []
12+
main_js_links = []
13+
asset_manifest = open("backend/static/js/" + type + "/build/.vite/manifest.json").read()
14+
asset_manifest_dict = json.loads(asset_manifest)
15+
for key, value in asset_manifest_dict.items():
16+
if key == "index.html":
17+
"""
18+
{'index.html':
19+
{'file': 'assets/index-BtVi8doP.js', 'name': 'index', 'src': 'index.html', 'isEntry': True,
20+
'css': ['assets/index-n_ryQ3BS.css'],
21+
'assets': ['assets/react-CHdo91hT.svg']},
22+
'src/assets/react.svg': {'file': 'assets/react-CHdo91hT.svg',
23+
'src': 'src/assets/react.svg'
24+
}
25+
}
26+
"""
27+
full_js_link = "js/" + type + "/build/" + value.get("file")
28+
js_links = [full_js_link]
29+
main_js_links = [full_js_link]
30+
css_file = "js/" + type + "/build/" + value.get("css")[0]
31+
css_links = [css_file]
32+
print("DEBUG" * 100)
33+
print(css_links, js_links, main_js_links)
34+
print("DEBUG" * 100)
35+
return css_links, js_links, main_js_links

0 commit comments

Comments
 (0)