diff --git a/build.js b/build.js
index b896b72..5a25838 100644
--- a/build.js
+++ b/build.js
@@ -1,46 +1,60 @@
#!/usr/bin/env node
/**
- * Dog Calculator Build System - PRODUCTION VERSION
+ * Dog Calculator Build System - MODULAR VERSION
*
- * This FIXED build script generates iframe.html and dog-calculator-widget.js
- * with EXACTLY the same functionality from iframe.html as the single source of truth.
+ * This build script generates iframe.html and sundog-dog-food-calculator.js
+ * from modular source files in the src/ directory.
+ *
+ * Source files:
+ * - src/styles.css - All CSS styles
+ * - src/template.html - HTML structure
+ * - src/calculator.js - JavaScript functionality
+ *
+ * Output files:
+ * - iframe.html - Standalone calculator page
+ * - sundog-dog-food-calculator.js - Embeddable widget
*
* Usage: node build.js
- *
- * ✅ WORKS CORRECTLY - Fixed the previous broken implementation
*/
const fs = require('fs');
const path = require('path');
-console.log('🎯 Dog Calculator Build System - FIXED & WORKING');
+console.log('🎯 Dog Calculator Build System - MODULAR VERSION');
console.log('');
/**
- * Extract and parse components from the master iframe.html
+ * Read modular components from src directory
*/
-function parseIframeComponents() {
- if (!fs.existsSync('iframe.html')) {
- throw new Error('iframe.html not found - this is the master file that should exist');
+function readSourceComponents() {
+ const srcDir = 'src';
+
+ // Check if src directory exists
+ if (!fs.existsSync(srcDir)) {
+ throw new Error('src directory not found - please ensure modular files exist');
}
- const content = fs.readFileSync('iframe.html', 'utf8');
+ // Read CSS
+ const cssPath = path.join(srcDir, 'styles.css');
+ if (!fs.existsSync(cssPath)) {
+ throw new Error('src/styles.css not found');
+ }
+ const css = fs.readFileSync(cssPath, 'utf8').trim();
- // Extract CSS (everything between )
- const cssMatch = content.match(/
@@ -80,30 +100,14 @@ function generateIframe(css, html, js) {