fix: Use different key for RTL assets
This commit is contained in:
parent
6df9fd2bf8
commit
70e4b8a459
3 changed files with 9 additions and 8 deletions
|
|
@ -385,7 +385,11 @@ async function write_assets_json(metafile) {
|
|||
let info = metafile.outputs[output];
|
||||
let asset_path = "/" + path.relative(sites_path, output);
|
||||
if (info.entryPoint) {
|
||||
out[path.basename(info.entryPoint)] = asset_path;
|
||||
let key = path.basename(info.entryPoint);
|
||||
if (key.endsWith('.css') && asset_path.includes('/css-rtl/')) {
|
||||
key = `rtl_${key}`;
|
||||
}
|
||||
out[key] = asset_path;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -170,10 +170,10 @@ frappe.assets = {
|
|||
|
||||
bundled_asset(path, is_rtl=null) {
|
||||
if (!path.startsWith('/assets') && path.includes('.bundle.')) {
|
||||
path = frappe.boot.assets_json[path] || path;
|
||||
if (path.endsWith('.css') && is_rtl) {
|
||||
path = path.replace('/css/', '/css-rtl/');
|
||||
path = `rtl_${path}`;
|
||||
}
|
||||
path = frappe.boot.assets_json[path] || path;
|
||||
return path;
|
||||
}
|
||||
return path;
|
||||
|
|
|
|||
|
|
@ -75,9 +75,6 @@ def include_script(path):
|
|||
|
||||
def include_style(path, rtl=None):
|
||||
path = bundled_asset(path)
|
||||
|
||||
if is_rtl(rtl):
|
||||
path = path.replace('/css/', '/css-rtl/')
|
||||
return f'<link type="text/css" rel="stylesheet" href="{path}">'
|
||||
|
||||
|
||||
|
|
@ -87,9 +84,9 @@ def bundled_asset(path, rtl=None):
|
|||
|
||||
if ".bundle." in path and not path.startswith("/assets"):
|
||||
bundled_assets = get_assets_json()
|
||||
path = bundled_assets.get(path) or path
|
||||
if path.endswith('.css') and is_rtl(rtl):
|
||||
path = path.replace('/css/', '/css-rtl/')
|
||||
path = f"rtl_{path}"
|
||||
path = bundled_assets.get(path) or path
|
||||
|
||||
return abs_url(path)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue