bertui 1.0.2 → 1.0.3
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/index.js +1 -1
- package/package.json +1 -1
- package/src/build.js +21 -5
package/index.js
CHANGED
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -157,6 +157,7 @@ async function copyAllStaticAssets(root, outDir, optimize = true) {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
// COMBINE ALL CSS INTO ONE FILE
|
|
160
|
+
// COMBINE ALL CSS INTO ONE FILE - FIXED BUN API
|
|
160
161
|
async function buildAllCSS(root, outDir) {
|
|
161
162
|
const srcStylesDir = join(root, 'src', 'styles');
|
|
162
163
|
const stylesOutDir = join(outDir, 'styles');
|
|
@@ -167,12 +168,20 @@ async function buildAllCSS(root, outDir) {
|
|
|
167
168
|
const cssFiles = readdirSync(srcStylesDir).filter(f => f.endsWith('.css'));
|
|
168
169
|
logger.info(`📦 Found ${cssFiles.length} CSS files to combine`);
|
|
169
170
|
|
|
171
|
+
if (cssFiles.length === 0) {
|
|
172
|
+
logger.warn('⚠️ No CSS files found in src/styles/');
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
170
176
|
// COMBINE ALL CSS INTO ONE FILE
|
|
171
177
|
let combinedCSS = '';
|
|
178
|
+
let totalOriginalSize = 0;
|
|
172
179
|
|
|
173
180
|
for (const cssFile of cssFiles) {
|
|
174
181
|
const srcPath = join(srcStylesDir, cssFile);
|
|
175
|
-
const
|
|
182
|
+
const file = Bun.file(srcPath);
|
|
183
|
+
const cssContent = await file.text();
|
|
184
|
+
totalOriginalSize += file.size;
|
|
176
185
|
combinedCSS += `/* === ${cssFile} === */\n${cssContent}\n\n`;
|
|
177
186
|
}
|
|
178
187
|
|
|
@@ -181,16 +190,23 @@ async function buildAllCSS(root, outDir) {
|
|
|
181
190
|
await Bun.write(combinedPath, combinedCSS);
|
|
182
191
|
|
|
183
192
|
// Minify it
|
|
184
|
-
await buildCSS(combinedPath, combinedPath);
|
|
193
|
+
const minified = await buildCSS(combinedPath, combinedPath);
|
|
185
194
|
|
|
186
|
-
|
|
187
|
-
|
|
195
|
+
// Get final size
|
|
196
|
+
const finalFile = Bun.file(combinedPath);
|
|
197
|
+
const finalSize = finalFile.size / 1024;
|
|
198
|
+
const originalSize = totalOriginalSize / 1024;
|
|
199
|
+
const savings = ((originalSize - finalSize) / originalSize * 100).toFixed(1);
|
|
200
|
+
|
|
201
|
+
logger.success(`✅ Combined ${cssFiles.length} CSS files (${originalSize.toFixed(1)}KB) → bertui.min.css (${finalSize.toFixed(1)}KB, -${savings}%)`);
|
|
188
202
|
|
|
189
203
|
} else {
|
|
190
204
|
logger.warn('⚠️ No src/styles/ directory found');
|
|
205
|
+
// Create empty CSS file so build doesn't fail
|
|
206
|
+
const emptyPath = join(stylesOutDir, 'bertui.min.css');
|
|
207
|
+
await Bun.write(emptyPath, '/* No CSS files found */');
|
|
191
208
|
}
|
|
192
209
|
}
|
|
193
|
-
|
|
194
210
|
async function compileForBuild(root, buildDir, envVars) {
|
|
195
211
|
const srcDir = join(root, 'src');
|
|
196
212
|
const pagesDir = join(srcDir, 'pages');
|