CLAUDE.md - AI Assistant Context
This document contains important context and learnings for AI assistants working on this Jekyll-based contemplative neuroscience website.
Project Overview
This is a Jekyll 3.9.5 static site that collects accessible summaries of peer-reviewed research at the intersection of meditation and brain science.
Key Technical Details
Sass/CSS Architecture
- Sass files location: This project uses a non-standard Sass setup:
- Main Sass files are in
/css/
directory (not/_sass/
) - Files have Jekyll front matter (
---
) which means Jekyll processes them directly - However,
@import
statements still look in/_sass/
directory by default
- Main Sass files are in
- Important files:
/css/main.sass
- Main stylesheet/css/tooltip.sass
- Tooltip-specific styles/css/pages.sass
- Page-specific styles (imports from _sass/pages/)/css/components.sass
- Component styles (imports from _sass/components/)/_sass/_variables.sass
- Centralized variables (must be in _sass for imports to work)/_sass/pages/_home.sass
- Home page component styles/_sass/pages/_theme.sass
- Theme page component styles/_sass/pages/_all-papers.sass
- All papers page component styles/_sass/pages/_glossary.sass
- Glossary page component styles/_sass/pages/_themes-index.sass
- Themes index page component styles/_sass/components/_breadcrumbs.sass
- Breadcrumb navigation styles/_sass/components/_animations.sass
- Scroll animations and transitions/_sass/components/_dynamic-backgrounds.sass
- Dynamic background image handling/_sass/mixins/_background.sass
- Background image mixins/assets/js/dynamic-backgrounds.js
- JavaScript for setting background images from data attributes
- Build commands: Always use
bundle exec jekyll build
to avoid gem version conflicts
CSS Variable System
The project uses semantic color variables defined in /_sass/_variables.sass
:
- Primary colors:
$color-primary
,$color-primary-dark
,$color-primary-light
- Text colors:
$color-text-primary
,$color-text-secondary
,$color-text-muted
- Typography:
$font-family-serif
,$font-family-sans
- Layout:
$content-max-width
,$tooltip-width
- Spacing: Based on
$base-unit
(16px) with multipliers
Common Issues & Solutions
- Import errors: If you see “File to import not found or unreadable”, ensure imported files are in
/_sass/
directory - Variable naming: The project previously used inconsistent names (e.g.,
$tool-tip-width
vs$tooltip-width
). All are now standardized - Color consistency: Many slightly different color values (#333, #333332, #333333) have been consolidated
SEO Considerations
- The site has good SEO foundations but needs image optimization (logo.png is 2.8MB!)
- All pages should have meta_description in front matter
- Posts use structured data (Article schema)
Testing & Validation
Before committing CSS changes:
cd /home/craig/projects/personal/contemplativeneuroscience
bundle exec jekyll build
Check for any Sass compilation errors in the output.
Content Structure
- Research papers are in
/_posts/
with specific front matter including DOI, citations, and themes - Themes are organized as separate pages in
/themes/
- The glossary (
/glossary/
) contains definitions of key terms
Development Guidelines
- DRY Principle: Always check
/_sass/_variables.sass
before adding new colors or dimensions - Component styles: Consider extracting inline styles to separate component files
- Consistency: Use semantic variable names rather than hardcoded values
- Mobile-first: The site uses responsive design with breakpoints at 768px, 800px, and 1024px
CSS Architecture Evolution
Completed Refactoring (2025-05-25)
- Variable consolidation - All colors, spacing, and typography now use semantic variables
- Inline style extraction - Removed 900+ lines of inline CSS across templates:
- Glossary page (120 lines)
- Themes index (67 lines)
- All-papers page (174 lines)
- Dynamic backgrounds via data attributes
- Component-based architecture - Styles organized into:
/css/pages.sass
- Page-specific styles/css/components.sass
- Reusable components/_sass/pages/
- Individual page styles/_sass/components/
- Component styles/_sass/mixins/
- Shared mixins
JavaScript Style Management
- Replaced direct style manipulation with CSS classes
- Use
.classList.add/remove()
instead of.style.property
- Dynamic backgrounds use
data-bg-image
attributes
JavaScript Architecture & Minification
- JavaScript files organization:
/assets/js/bundle.js
- Main application JavaScript (jQuery-based)/assets/js/all-papers.js
- Search and sort functionality for papers page/assets/js/glossary.js
- Toggle functionality for glossary related articles- All JavaScript previously inline in templates has been extracted to separate files
- Minification setup (Added 2025-05-27):
- Scripts location:
/scripts/minify-js.sh
- Bash script for minifying JS files - Output: Creates
.min.js
versions of all JavaScript files - Tool: Uses
uglifyjs
for minification (install withnpm install -g uglify-js
) - Development workflow: Use
/scripts/serve-with-minify.sh
for auto-minification during development
- Scripts location:
- Deployment considerations:
- Site is deployed on GitHub Pages, so no custom Jekyll plugins allowed
- Minification must be done locally before committing
- Minified files should be committed to the repository
- Reference minified versions in production
- Running minification:
# One-time minification ./scripts/minify-js.sh # Development with auto-minification ./scripts/serve-with-minify.sh
- File watching requirements:
- macOS:
brew install fswatch
- Linux:
sudo apt-get install inotify-tools
- macOS:
Future Improvements Identified
From the SEO and CSS audits, priority improvements include:
- ✅ Variable consolidation (completed)
- ✅ Extract inline styles from templates (completed)
- Image optimization (especially logo.png - currently 2.8MB!)
- Implement consistent mixins for common patterns
- Add missing meta tags and schema markup
- Page title truncation to 70 characters (partially implemented)
Common Patterns & Best Practices
CSS Refactoring Approach
- Extract inline styles to components - Create semantic component files rather than utility classes
- Use data attributes for dynamic values - Replace
style="background-image: url()"
withdata-bg-image
- State classes over style manipulation - Use
.visible
,.expanded
,.active
instead of display/transform styles - Consistent variable usage - Always check
_variables.sass
before adding new values
File Organization
- Page-specific styles go in
/_sass/pages/
- Reusable components go in
/_sass/components/
- Mixins go in
/_sass/mixins/
- Each major CSS file in
/css/
should only contain imports
Common Pitfalls to Avoid
- Don’t put variables in
/css/
- They must be in/_sass/
for imports to work - Check for duplicate variable definitions - Especially in tooltip.sass and main.sass
- Use exact string matching for edits - Whitespace and newlines matter in multiline replacements
- Test builds frequently - Sass compilation errors aren’t always obvious
Notes for AI Assistants
- When asked about CSS/Sass issues, always check the actual file structure first - don’t assume standard Jekyll conventions
- The site uses Sass indented syntax (.sass) not SCSS (.scss)
- Be careful with variable replacements - use exact string matching or context-aware replacements
- Always test builds after CSS changes to catch compilation errors early
- When refactoring inline styles, check for JavaScript that may depend on them
- The subscribe.html file contains 590+ lines of third-party CSS - handle with care
Last updated: 2025-05-27