@terrymooreii/sia 2.1.10 → 2.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assets.js +23 -21
- package/package.json +1 -1
package/lib/assets.js
CHANGED
|
@@ -134,39 +134,41 @@ function hasCssFiles(dir) {
|
|
|
134
134
|
export function copyDefaultStyles(config, resolvedTheme = null) {
|
|
135
135
|
const outputStylesDir = join(config.outputDir, 'styles');
|
|
136
136
|
|
|
137
|
-
//
|
|
138
|
-
const userStylesDir = join(config.rootDir, 'styles');
|
|
139
|
-
|
|
140
|
-
if (hasCssFiles(userStylesDir)) {
|
|
141
|
-
// Copy user styles
|
|
142
|
-
const copied = copyAssets(userStylesDir, outputStylesDir);
|
|
143
|
-
console.log(`🎨 Copied ${copied.length} custom style files`);
|
|
144
|
-
return copied;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// Resolve theme if not already resolved
|
|
137
|
+
// Always copy theme styles first
|
|
148
138
|
const themeName = config.theme?.name || 'main';
|
|
149
139
|
const theme = resolvedTheme || resolveTheme(themeName, config.rootDir);
|
|
150
140
|
const themeStylesDir = join(theme.themeDir, 'styles');
|
|
151
141
|
|
|
142
|
+
let themeCopied = [];
|
|
152
143
|
if (existsSync(themeStylesDir)) {
|
|
153
|
-
|
|
144
|
+
themeCopied = copyAssets(themeStylesDir, outputStylesDir);
|
|
154
145
|
if (!theme.isExternal) {
|
|
155
146
|
console.log(`🎨 Using "${theme.themeName}" theme`);
|
|
156
147
|
}
|
|
157
|
-
|
|
148
|
+
} else {
|
|
149
|
+
// Fallback to main theme if theme styles not found
|
|
150
|
+
const fallbackStylesDir = join(getBuiltInThemesDir(), 'main', 'styles');
|
|
151
|
+
if (existsSync(fallbackStylesDir)) {
|
|
152
|
+
console.log(`⚠️ Theme "${themeName}" styles not found, using "main" theme styles`);
|
|
153
|
+
themeCopied = copyAssets(fallbackStylesDir, outputStylesDir);
|
|
154
|
+
}
|
|
158
155
|
}
|
|
159
156
|
|
|
160
|
-
//
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
157
|
+
// Then copy user custom styles (can override theme styles)
|
|
158
|
+
const userStylesDir = join(config.rootDir, 'styles');
|
|
159
|
+
let userCopied = [];
|
|
160
|
+
|
|
161
|
+
if (hasCssFiles(userStylesDir)) {
|
|
162
|
+
userCopied = copyAssets(userStylesDir, outputStylesDir);
|
|
163
|
+
console.log(`🎨 Copied ${userCopied.length} custom style file(s)`);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const totalCopied = themeCopied.length + userCopied.length;
|
|
167
|
+
if (totalCopied === 0) {
|
|
168
|
+
console.log('⚠️ No styles found');
|
|
166
169
|
}
|
|
167
170
|
|
|
168
|
-
|
|
169
|
-
return [];
|
|
171
|
+
return [...themeCopied, ...userCopied];
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
/**
|