File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -540,7 +540,7 @@ jobs:
540
540
table-visual-test :
541
541
working_directory : ~/dash/components/dash-table
542
542
docker :
543
- - image : cimg/node:16.13 -browsers
543
+ - image : cimg/node:lts -browsers
544
544
environment :
545
545
PERCY_TOKEN : $PERCY_TOKEN_TABLE
546
546
@@ -551,7 +551,6 @@ jobs:
551
551
- restore_cache :
552
552
key : dep-{{ .Branch }}-{{ checksum "package-lock.json" }}-{{ checksum "package.json" }}
553
553
- browser-tools/install-browser-tools :
554
- chrome-version : 120.0.6099.71
555
554
install-firefox : false
556
555
install-geckodriver : false
557
556
- run :
Original file line number Diff line number Diff line change 5
5
6
6
7
7
def get_asset_url (path ):
8
+ """
9
+ Return the URL for the provided `path` in the assets directory.
10
+
11
+ `dash.get_asset_url` is not compatible with Dash Snapshots.
12
+ Use `get_asset_url` on the app instance instead: `app.get_asset_url`.
13
+ See `app.get_asset_url` for more information.
14
+ """
8
15
return app_get_asset_url (CONFIG , path )
9
16
10
17
@@ -59,6 +66,9 @@ def display_content(path):
59
66
if page_name == "page-2":
60
67
return chapters.page_2
61
68
```
69
+
70
+ `dash.get_relative_path` is not compatible with Dash Snapshots. Use
71
+ `get_relative_path` on the app instance instead: `app.get_relative_path`.
62
72
"""
63
73
return app_get_relative_path (CONFIG .requests_pathname_prefix , path )
64
74
Original file line number Diff line number Diff line change @@ -1723,6 +1723,33 @@ def _hash(script):
1723
1723
]
1724
1724
1725
1725
def get_asset_url (self , path ):
1726
+ """
1727
+ Return the URL for the provided `path` in the assets directory.
1728
+
1729
+ If `assets_external_path` is set, `get_asset_url` returns
1730
+ `assets_external_path` + `assets_url_path` + `path`, where
1731
+ `path` is the path passed to `get_asset_url`.
1732
+
1733
+ Otherwise, `get_asset_url` returns
1734
+ `requests_pathname_prefix` + `assets_url_path` + `path`, where
1735
+ `path` is the path passed to `get_asset_url`.
1736
+
1737
+ Use `get_asset_url` in an app to access assets at the correct location
1738
+ in different environments. In a deployed app on Dash Enterprise,
1739
+ `requests_pathname_prefix` is the app name. For an app called "my-app",
1740
+ `app.get_asset_url("image.png")` would return:
1741
+
1742
+ ```
1743
+ /my-app/assets/image.png
1744
+ ```
1745
+
1746
+ While the same app running locally, without
1747
+ `requests_pathname_prefix` set, would return:
1748
+
1749
+ ```
1750
+ /assets/image.png
1751
+ ```
1752
+ """
1726
1753
return _get_paths .app_get_asset_url (self .config , path )
1727
1754
1728
1755
def get_relative_path (self , path ):
You can’t perform that action at this time.
0 commit comments