mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-23 08:10:52 +02:00
FEAT: introduce bundle_assets variable and decouple it from DEBUG (#1660)
This commit is contained in:
@@ -59,15 +59,15 @@ def template_renderer(additional_folders: Optional[List] = None) -> Jinja2Templa
|
|||||||
if settings.lnbits_custom_logo:
|
if settings.lnbits_custom_logo:
|
||||||
t.env.globals["USE_CUSTOM_LOGO"] = settings.lnbits_custom_logo
|
t.env.globals["USE_CUSTOM_LOGO"] = settings.lnbits_custom_logo
|
||||||
|
|
||||||
if settings.debug:
|
if settings.bundle_assets:
|
||||||
|
t.env.globals["INCLUDED_JS"] = ["/static/bundle.min.js"]
|
||||||
|
t.env.globals["INCLUDED_CSS"] = ["/static/bundle.min.css"]
|
||||||
|
else:
|
||||||
vendor_filepath = Path(settings.lnbits_path, "static", "vendor.json")
|
vendor_filepath = Path(settings.lnbits_path, "static", "vendor.json")
|
||||||
with open(vendor_filepath) as vendor_file:
|
with open(vendor_filepath) as vendor_file:
|
||||||
vendor_files = json.loads(vendor_file.read())
|
vendor_files = json.loads(vendor_file.read())
|
||||||
t.env.globals["INCLUDED_JS"] = vendor_files["js"]
|
t.env.globals["INCLUDED_JS"] = vendor_files["js"]
|
||||||
t.env.globals["INCLUDED_CSS"] = vendor_files["css"]
|
t.env.globals["INCLUDED_CSS"] = vendor_files["css"]
|
||||||
else:
|
|
||||||
t.env.globals["INCLUDED_JS"] = ["/static/bundle.min.js"]
|
|
||||||
t.env.globals["INCLUDED_CSS"] = ["/static/bundle.min.css"]
|
|
||||||
|
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
@@ -227,6 +227,7 @@ class EditableSettings(
|
|||||||
|
|
||||||
class EnvSettings(LNbitsSettings):
|
class EnvSettings(LNbitsSettings):
|
||||||
debug: bool = Field(default=False)
|
debug: bool = Field(default=False)
|
||||||
|
bundle_assets: bool = Field(default=True)
|
||||||
host: str = Field(default="127.0.0.1")
|
host: str = Field(default="127.0.0.1")
|
||||||
port: int = Field(default=5000)
|
port: int = Field(default=5000)
|
||||||
forwarded_allow_ips: str = Field(default="*")
|
forwarded_allow_ips: str = Field(default="*")
|
||||||
|
Reference in New Issue
Block a user