@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.
Files changed (2) hide show
  1. package/lib/assets.js +23 -21
  2. 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
- // Check if user has custom styles (must actually have CSS files)
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
- const copied = copyAssets(themeStylesDir, outputStylesDir);
144
+ themeCopied = copyAssets(themeStylesDir, outputStylesDir);
154
145
  if (!theme.isExternal) {
155
146
  console.log(`🎨 Using "${theme.themeName}" theme`);
156
147
  }
157
- return copied;
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
- // Fallback to main theme if theme styles not found
161
- const fallbackStylesDir = join(getBuiltInThemesDir(), 'main', 'styles');
162
- if (existsSync(fallbackStylesDir)) {
163
- console.log(`⚠️ Theme "${themeName}" styles not found, using "main" theme styles`);
164
- const copied = copyAssets(fallbackStylesDir, outputStylesDir);
165
- return copied;
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
- console.log('⚠️ No styles found');
169
- return [];
171
+ return [...themeCopied, ...userCopied];
170
172
  }
171
173
 
172
174
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@terrymooreii/sia",
3
- "version": "2.1.10",
3
+ "version": "2.1.11",
4
4
  "description": "A simple, powerful static site generator with markdown, front matter, and Nunjucks templates",
5
5
  "main": "lib/index.js",
6
6
  "bin": {