Skip to content

Commit bd2da4d

Browse files
committed
dist/esm: polish file paths for theme css imports #6725
1 parent faeab3b commit bd2da4d

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

buildScripts/buildESModules.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function minifyDirectory(inputDir, outputDir) {
3535
const jsonContent = JSON.parse(content);
3636

3737
if (dirent.name === 'neo-config.json') {
38-
jsonContent.basePath = '../../' + jsonContent.basePath;
38+
//jsonContent.basePath = '../../' + jsonContent.basePath;
3939
jsonContent.environment = 'dist/esm';
4040
}
4141

src/main/addon/Stylesheet.mjs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,18 @@ class Stylesheet extends Base {
4343
super.construct(config);
4444

4545
let neoConfig = Neo.config,
46+
env = neoConfig.environment,
4647
faPath;
4748

4849
if (neoConfig.useFontAwesome) {
49-
if (neoConfig.environment === 'development' || neoConfig.environment === 'dist/esm') {
50-
faPath = neoConfig.basePath + 'node_modules/@fortawesome/fontawesome-free/css/all.min.css'
50+
if (env === 'development' || env === 'dist/esm') {
51+
faPath = neoConfig.basePath + 'node_modules/@fortawesome/fontawesome-free/css/all.min.css';
52+
53+
if (env === 'dist/esm') {
54+
faPath = '../../' + faPath
55+
}
5156
} else {
52-
faPath = neoConfig.basePath.substr(6) + 'resources/fontawesome-free/css/all.min.css'
57+
faPath = neoConfig.basePath.substring(6) + 'resources/fontawesome-free/css/all.min.css'
5358
}
5459

5560
this.createStyleSheet(null, null, faPath)
@@ -73,6 +78,10 @@ class Stylesheet extends Base {
7378

7479
document.body.classList.add(themes[0]);
7580

81+
if (env === 'dist/esm') {
82+
path = '../../' + path;
83+
}
84+
7685
folders.forEach(folder => {
7786
if (folder.startsWith('neo-')) {
7887
folder = folder.substring(4)
@@ -100,6 +109,10 @@ class Stylesheet extends Base {
100109
promises = [],
101110
rootPath = config.basePath.substring(6);
102111

112+
if (env === 'dist/esm') {
113+
path = '../../' + path;
114+
}
115+
103116
if (className.startsWith('Neo.')) {
104117
className = className.substring(4)
105118
}

0 commit comments

Comments
 (0)