Hi,
Can you try dotnet clean
,dotnet build
and abp bundle
again?
You can share a project with me if the problem still exists, I will check it. shiwei.liang@volosoft.com
Hi,
Did you update the BundleContributor
?
Hi,
I could not reproduce the problem, could you share a project that can reproduce the problem with me? shiwei.liang@volosoft.com
HI,
I will check it
Hi,
Sorry I could not reproduce the problem, could you use the suite to create a new project to reproduce and share with me? shiwei.liang@volosoft.com. thanks.
Hi,
Try the following steps:
dotnet build
and abp bundle
lang-initializer.js
window.afterLeptonXInitialization = function() {
console.log("afterLeptonXInitialization");
var isRtl = JSON.parse(localStorage.getItem("Abp.IsRtl"));
var direction = isRtl ? "rtl" : "ltr";
replaceStyleWith(
createStyleUrl('layout-bundle', direction),
`lpx-layout-bundle-style-${direction}`,
`lpx-layout-bundle-style-${direction === 'rtl' ? 'ltr' : 'rtl'}`
);
replaceStyleWith(
createStyleUrl('abp-bundle', direction),
`lpx-abp-bundle-style-${direction}`,
`lpx-abp-bundle-style-${direction === 'rtl' ? 'ltr' : 'rtl'}`
);
replaceStyleWith(
createStyleUrl('blazor-bundle', direction),
`lpx-blazor-bundle-style-${direction}`,
`lpx-blazor-bundle-style-${direction === 'rtl' ? 'ltr' : 'rtl'}`
);
replaceStyleWith(
createStyleUrl('font-bundle', direction),
`lpx-font-bundle-style-${direction}`,
`lpx-font-bundle-style-${direction === 'rtl' ? 'ltr' : 'rtl'}`
);
function createStyleUrl(theme, direction='ltr') {
const styleName = direction === 'rtl' ? `${theme}.rtl` : theme;
return `_content/Volo.Abp.AspNetCore.Components.Web.LeptonXTheme/${window.currentLayout}/css/${styleName}.css`
}
function createId(theme, type) {
return theme && `lpx-theme-${type}-${theme}`;
}
function replaceStyleWith(path, id, previousId) {
const link = document.createElement('link');
link.href = path;
link.type = 'text/css';
link.rel = 'stylesheet';
link.id = id;
const prevElem = document.querySelector(`#${previousId}`);
document.getElementsByTagName('head')[0].appendChild(link);
if (previousId) {
prevElem?.remove();
}
return link;
}
function loadThemeCSS(key, theme, themeOld, cssPrefix, direction='ltr') {
const themeId = createId(theme, key);
const previousThemeId = createId(themeOld, key);
replaceStyleWith(createStyleUrl(cssPrefix + theme, direction), themeId, previousThemeId);
}
};
style-initializer.js
window.afterLeptonXInitialization = function() {
console.log("afterLeptonXInitialization");
var isRtl = JSON.parse(localStorage.getItem("Abp.IsRtl"));
var direction = isRtl ? "rtl" : "ltr";
replaceStyleWith(
createStyleUrl('layout-bundle', direction),
`lpx-layout-bundle-style-${direction}`,
`lpx-layout-bundle-style-${direction === 'rtl' ? 'ltr' : 'rtl'}`
);
replaceStyleWith(
createStyleUrl('abp-bundle', direction),
`lpx-abp-bundle-style-${direction}`,
`lpx-abp-bundle-style-${direction === 'rtl' ? 'ltr' : 'rtl'}`
);
replaceStyleWith(
createStyleUrl('blazor-bundle', direction),
`lpx-blazor-bundle-style-${direction}`,
`lpx-blazor-bundle-style-${direction === 'rtl' ? 'ltr' : 'rtl'}`
);
replaceStyleWith(
createStyleUrl('font-bundle', direction),
`lpx-font-bundle-style-${direction}`,
`lpx-font-bundle-style-${direction === 'rtl' ? 'ltr' : 'rtl'}`
);
function createStyleUrl(theme, direction='ltr') {
const styleName = direction === 'rtl' ? `${theme}.rtl` : theme;
return `_content/Volo.Abp.AspNetCore.Components.Web.LeptonXTheme/${window.currentLayout}/css/${styleName}.css`
}
function createId(theme, type) {
return theme && `lpx-theme-${type}-${theme}`;
}
function replaceStyleWith(path, id, previousId) {
const link = document.createElement('link');
link.href = path;
link.type = 'text/css';
link.rel = 'stylesheet';
link.id = id;
const prevElem = document.querySelector(`#${previousId}`);
document.getElementsByTagName('head')[0].appendChild(link);
if (previousId) {
prevElem?.remove();
}
return link;
}
function loadThemeCSS(key, theme, themeOld, cssPrefix, direction='ltr') {
const themeId = createId(theme, key);
const previousThemeId = createId(themeOld, key);
replaceStyleWith(createStyleUrl(cssPrefix + theme, direction), themeId, previousThemeId);
}
};
[YourProjectName]BundleContributor
public class [YourProjectName]BundleContributor : IBundleContributor
{
public void AddScripts(BundleContext context)
{
context.BundleDefinitions.RemoveAll(x => x.Source.Contains("lang-initializer.js"));
context.BundleDefinitions.RemoveAll(x => x.Source.Contains("style-initializer.js"));
context.Add("lang-initializer.js");
context.Add("style-initializer.js");
}
public void AddStyles(BundleContext context)
{
context.Add("main.css", true);
}
}
PS, don't forget to update the appsettings.json
file of DbMigrator
project to update the Blazor project's RootUrl
and update the database table.
HI,
I will check it
Hi,
You can custom the Tenant resolver instead of AppService , see: https://docs.abp.io/en/abp/latest/Multi-Tenancy#custom-tenant-resolvers
Hi,
Sorry for later, I could not reproduce the problem, can you share a project that can reproduce the problem with me? shiwei.liang@volosoft.com
Can you try clearing the browser cookies or open a private window to try again?