#!/bin/bash
cat « ‘EOF’
╔═══════════════════════════════════════════════════════════════════════════════╗ ║ ║ ║ HOW TO VERIFY CSS IS EMBEDDED IN YOUR APKG FILES ║ ║ ║ ╚═══════════════════════════════════════════════════════════════════════════════╝
FILES TO TEST WITH ════════════════════════════════════════════════════════════════════════════════
Run this command to generate test APKGs:
python3 « ‘PYTHON’ import json import tempfile from pathlib import Path from scripts.anki.apkg_generator import APKGGenerator
psy_data = { “metadata”: {“course”: “psychology”, “deck_name”: “Psy-Test”, “unit”: “U1”, “module”: “M1”}, “flashcards”: [{“id”: “1”, “question”: “Q?”, “answer”: “A”, “tags”: [“test”], “difficulty”: 1}] }
with tempfile.TemporaryDirectory() as tmpdir: gen = APKGGenerator() psy = gen.generate_from_data(psy_data, tmpdir, “Psy-Test”) import shutil shutil.copy(psy, Path.home() / “Desktop” / “psychology-test.apkg”) print(f"✅ Copied to ~/Desktop/psychology-test.apkg")
devops_data = { “metadata”: {“course”: “devops”, “deck_name”: “Dev-Test”, “unit”: “U1”, “module”: “M1”}, “flashcards”: [{“id”: “1”, “question”: “Q?”, “answer”: “A”, “tags”: [“test”], “difficulty”: 1}] }
with tempfile.TemporaryDirectory() as tmpdir: gen = APKGGenerator() dev = gen.generate_from_data(devops_data, tmpdir, “Dev-Test”) import shutil shutil.copy(dev, Path.home() / “Desktop” / “devops-test.apkg”) print(f"✅ Copied to ~/Desktop/devops-test.apkg")
PYTHON
OPTION 1: Check File Sizes (Simplest) ════════════════════════════════════════════════════════════════════════════════
ls -lh ~/Desktop/*.apkg
Expected Output: psychology-test.apkg 68 KB ← Includes psychology CSS devops-test.apkg 72 KB ← Includes devops CSS
Why it matters: • Default APKG would be ~56 KB • Psychology adds ~12 KB (CSS overhead) • DevOps adds ~16 KB (CSS overhead) • Size difference proves CSS is embedded
OPTION 2: Extract and View APKG Contents (Intermediate) ════════════════════════════════════════════════════════════════════════════════
cd ~/Desktop unzip -l psychology-test.apkg
Expected Output: Archive: psychology-test.apkg Length Date Time Name
69632 02-May-26 12:34 collection.anki2
2 02-May-26 12:34 media
Note: CSS is NOT a separate file - it’s embedded in the SQLite database inside collection.anki2 as part of the model templates.
OPTION 3: Inspect CSS in SQLite Database (Advanced) ════════════════════════════════════════════════════════════════════════════════
cd ~/Desktop unzip psychology-test.apkg collection.anki2
sqlite3 collection.anki2 « ‘SQL’ SELECT id, name, LENGTH(css) as css_length FROM models; SQL
Expected Output: id|name|css_length 1|Basic (with Difficulty)|16523 2|Cloze (with Difficulty)|16523 3|Hints (with Difficulty)|16523
The css_length of ~16,500+ bytes confirms psychology.css (16 KB) is embedded!
sqlite3 collection.anki2 « ‘SQL’ SELECT SUBSTR(css, 1, 200) FROM models WHERE id = 1; SQL
Expected Output: /**
This proves the psychology CSS is in the database!
OPTION 4: Compare CSS Between APKGs (Advanced) ════════════════════════════════════════════════════════════════════════════════
cd ~/Desktop unzip psychology-test.apkg collection.anki2 -d psy unzip devops-test.apkg collection.anki2 -d dev
sqlite3 psy/collection.anki2 “SELECT SUBSTR(css, 1, 100) FROM models WHERE id = 1;” > psy_css.txt sqlite3 dev/collection.anki2 “SELECT SUBSTR(css, 1, 100) FROM models WHERE id = 1;” > dev_css.txt
diff psy_css.txt dev_css.txt
Expected Output: Different header comments showing different courses: - Psychology version - DevOps version
This proves each APKG has its own course-specific CSS!
OPTION 5: Full CSS Extraction (If You Want to See All Styling) ════════════════════════════════════════════════════════════════════════════════
sqlite3 collection.anki2 “SELECT css FROM models WHERE id = 1;” > psychology-full.css
head -50 psychology-full.css grep -A 5 “.skill-card” psychology-full.css grep “color-primary” psychology-full.css
Expected Output: Shows all the psychology styling rules Colors, spacing, custom components, etc.
VISUAL TESTING IN ANKI DESKTOP ════════════════════════════════════════════════════════════════════════════════
Open Anki Desktop
File → Import
Select: ~/Desktop/psychology-test.apkg
Click Import
Look for Psychology Styling: ✓ Light blue background (#f0f7ff) ✓ Blue left border (4px) ✓ Blue text headings ✓ Professional color scheme
Import devops-test.apkg next
Look for DevOps Styling: ✓ Different colors (red, green, blue) ✓ Different feel from psychology ✓ Technical appearance
This visual check proves styling is rendered!
SUMMARY: HOW TO KNOW STYLING IS WORKING ════════════════════════════════════════════════════════════════════════════════
✅ File Size Test (Quick)
✅ SQLite Database Test (Definitive)
✅ Content Test (Visual)
✅ Anki Desktop Test (User Experience)
TROUBLESHOOTING: CSS NOT SHOWING UP ════════════════════════════════════════════════════════════════════════════════
Problem 1: APKG size is same as default (56 KB) Solution: 1. Check metadata has course field 2. Check course name is lowercase and exact 3. Recompile CSS: npm run anki:styles:compile 4. Regenerate APKG
Problem 2: SQLite query shows small css_length (~1000 bytes) Solution: 1. CSS didn’t compile 2. CSS file not found 3. Using default CSS fallback
Fix: npm run anki:styles:compile npm run anki:styles:list Verify files exist!
Problem 3: Anki Desktop cards have no color/styling Solution: 1. Check APKG was imported (not copied) 2. Clear Anki cache: Tools → Check Database 3. Force reload cards 4. Try on mobile Anki to compare
═══════════════════════════════════════════════════════════════════════════════
Ready to test? Follow TESTING_GUIDE.md for complete walkthrough!
═══════════════════════════════════════════════════════════════════════════════
EOF