Skip to content

Commit

Permalink
support minified
Browse files Browse the repository at this point in the history
  • Loading branch information
s-cork committed Sep 12, 2024
1 parent bd6e1e8 commit 7002122
Show file tree
Hide file tree
Showing 4 changed files with 29,274 additions and 6 deletions.
1 change: 1 addition & 0 deletions anvil.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ renamed: true
config_schema:
client:
cdn: {type: boolean, default_value: true}
minified: {type: boolean, default_value: true}
17 changes: 11 additions & 6 deletions client_code/Tabulator/_js_tabulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@
from anvil.js.window import Function

# from anvil.js.window import TabulatorModule
url = "https://cdn.skypack.dev/pin/[email protected]/mode=imports,min/optimized/tabulator-tables.js"

theme_url = (
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/tabulator{}.min.css"
)

config = anvil.app.get_client_config("tabulator")
if not config.get("cdn", True):
url = "./_/theme/tabulator-tables/js/tabulator_esm.min.js"
cdn = config.get("cdn", True)
minified = config.get("minified", True)

if cdn:
min = ",min" if minified else ""
url = f"https://cdn.skypack.dev/pin/[email protected]/mode=imports{min}/optimized/tabulator-tables.js"
theme_url = "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/tabulator{}.min.css"
else:
min = ".min" if minified else ""
url = f"./_/theme/tabulator-tables/js/tabulator_esm{min}.js"
theme_url = "./_/theme/tabulator-tables/css/tabulator{}.min.css"


TabulatorModule = import_from(url)


Expand Down
Loading

0 comments on commit 7002122

Please sign in to comment.